Home > Enterprise >  Docker container not running for a simple file
Docker container not running for a simple file

Time:01-07

FROM ubuntu

RUN apt-get update && apt-get install -y vim

the above is all i have in the docker file to just install vim over ubuntu

I run this in local using

docker build -t myFirstUbuntuimage .

Then if i run the container using the above image as

docker run -d --name myfirstcontainer myFirstUbuntuimage:latest

the container does not run. How can i make it run?

docker ps shows empty

CodePudding user response:

The container is probably running just fine. The default behavior of the ubuntu image is to start an interactive shell, but since you're starting a non-interactive container, the shell will just exit immediately.

What do you expect to happen when you run the container?

If you drop the -d and add -it, you'll get an interactive shell:

docker run -it --name myfirstcontainer myFirstUbuntuimage:latest
  •  Tags:  
  • Related