Maneesh Murali
Maneesh Murali

Reputation: 11

Docker container not running for a simple file

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

Upvotes: 0

Views: 74

Answers (1)

larsks
larsks

Reputation: 312410

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

Upvotes: 1

Related Questions