I want to build a docker image from ubuntu image. It is required to change the default sh from dash to bash manually. (Because it require to install many rpm packages which contains bash scripts)

dpkg-reconfigure dash

Is there any method to let this action automatically without human behavior?

In my Dockerfile it maybe written as(Method 1)

RUN dpkg-reconfigure dash

I've tried another method(Method 2)

RUN ln -sf bash /bin/sh

But, both method can not work.


You can make debconf only ask for high or critical questions[1].


dpkg-reconfigure -p critical dash

dpkg-reconfigure will use default answer defined in debconf script. You can also use debconf-get-selections to pick up different answer for noninteractive installation[2].

  1. https://wiki.debian.org/debconf
  2. http://blog.nutsfactory.net/2008/03/06/noninteractive-dpkg-installation-on-debian-system/
  • If you want to see what's going on when runing dpkg-reconfigure DEBCONF_DEBUG=developer dpkg-reconfigure -p critical dash – Rex Tsai Feb 12 '14 at 11:06
  • debconf-get-selections is missing. I can not found in packages.debian.org/wheezy/all/debconf/filelist. – Daniel YC Lin Feb 12 '14 at 11:13
  • 12
    I use debconf-show dash to get options. echo "dash dash/sh boolean false" | debconf-set-selections and DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash to do non-interactive configuring. – Daniel YC Lin Feb 12 '14 at 11:38
  • 2
    @DanielYCLin if you added that as its own answer, I would upvote it. – gazarsgo Apr 28 '14 at 20:09

Pasting Daniel's comment as an answer here since it doesn't rely on default settings from dpkg-reconfigure.

To get options:

debconf-show dash

To set this particular option to false:

echo "dash dash/sh boolean false" | debconf-set-selections

and to actually reconfigure the package:

DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash

This worked for me from a Dockerfile:

# make /bin/sh symlink to bash instead of dash:
RUN echo "dash dash/sh boolean false" | debconf-set-selections
RUN DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.