Wicia
Wicia

Reputation: 565

Docker initializing volume exiting container

I am running scripts from:

https://www.tutorialspoint.com/docker/docker_storage.htm > Data Volumes

When I want to perform such script:

docker run -d -v /home/docker/demo:/nexus-data --name="volume" sonatype/nexus3

I see on container list that volume container is Up and running but after few seconds it state change to Exited, why?

Upvotes: 0

Views: 1249

Answers (2)

Mornor
Mornor

Reputation: 3793

You could try to see the live logs of the Docker container with the following command (basically, remove -d and add -it):

docker run -it -v /home/docker/demo:/nexus-data --name="volume" sonatype/nexus3

And try to pin points the exact issue.

Upvotes: 1

Dimitar
Dimitar

Reputation: 182

A docker container exits when the main process finishes. For example if you execute a command that will generate some output - it will execute it (depend of settings save it) and exit.

Upvotes: 1

Related Questions