1

I've created a dockerfile with various compile and build tools. The goal of the dockerimage is to standardize our development tools, and make it easy and consistent for developing.

Everything is installed.

What I am stuck on, is how to make the docker container keep running, and be able to have a bash shell to that container so that I can run, for example, make etc. ?

If I use ENTRYPOINT /bin/bash my container exits immediately. How to keep the container running?

2 Answers 2

0

You should use the command at run time. You run your Docker container in interatice mode (-i) and set the command to "/bin/bash":

docker run -it myDockerImage myCommandToExecuteInteractively

For instance:

docker run -it myDocker /bin/bash

Here is a real life example:

a) Pulling the most basic image

docker pull debian:jessie-slim

b) Let's have a bash there:

docker run -it debian:jessie-slim /bin/bash

c) Enjoy: enter image description here

0

A docker container will run as long as the CMD/Entrypoint from your Dockerfile takes.

You can run your Docker container in interactive mode using switch i

sudo docker run -it --entrypoint=/bin/bash <imagename>

Example : docker run -it --entrypoint=/bin/bash ubuntu:14.04 This will start an interactive shell in your container. Your container will exit as soon as you exit that shell.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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