As part of my deployment strategy, I am managing Docker containers with Upstart.
To do that, I need to pull an image from a registry and create a named container (as suggested on Upstart script to run container won't manage lifecycle )
Is there a way to create the container without first running the image? I don't want to have to start a container (which may introduce side effects), stop it, and then manage elsewhere.
For example, something like:
docker.io create -e ENV1=a -e ENV2=b -p 80:80 --name my_first_container sample/containe
If we want to create a container without running it immediately, we can use the Docker Create command below. The command will create a container called appserver using the Python Docker image. If I run docker ps I won't see it because it is not running.
The docker container create (or shorthand: docker create ) command creates a new container from the specified image, without starting it. When creating a container, the docker daemon creates a writeable container layer over the specified image and prepares it for running the specified command.
You can use Portainer.io portainer.io It's a web app that runs inside a docker container used to manage all (almost) stuff about your containers. Even images recepies.
No its not like that. To create any docker image using DockerFile, You need to start with a base docker image. That base docker image can be anything, Like an empty image as well, In the docker file in your example the FROM section says ubuntu, it means its assuming ubuntu as the base image.
In case anyone else comes across this question, it can now be done with the docker create
command. See https://docs.docker.com/engine/reference/commandline/create/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With