Why the RUN command in this dockerfile is not working

Why the RUN command in this dockerfile is not working

I have a docker image MyBaseImage where I have Open SSH server installed. Now in the docker file, I have the following. Download base image FROM MyBaseImage RUN service ssh start I build the new image by typing docker build . Docker builds the image fine, giving the following information. Step 12 : FROM MyBaseImage --- 56f88e347f77 Step 22 : RUN service ssh start --- Running in a1afe0c2ce71 Starting OpenBSD Secure Shell server sshd OK Removing intermediate container a1afe0c2ce71 --- 7879cebe8b6a But when I run the new image by typing docker run -it 7879cebe8b6a Docker builds the image fine, giving the following information. If I type service ssh status inside the terminal of that container, it says sshd is not running I have to then manually start the Open SSH server by typing service ssh start. What could be the reason for it

Depending on which distro of linux you are using command slightly changes: If you are using ubuntu your start command should work. But if your base image is centosRHEL try below: service sshd start

Комментарии

Популярные сообщения из этого блога

Skipping acquire of configured file 'contrib/binary-i386/Packages' as repository … doesn't support architecture 'i386'

Connection string for MariaDB using ODBC

Celery like system based on django channels