You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No. docker-compose build creates an image from Dockerfile (like docker build).
If you docker create then a new container is instanciated from an image but not started. This looks like docker run -d and then docker stop without really starting it. So it is like to have a docker-compose up with creating the containers but not starting them.
This is useful if you start e. g. a database container and link it to more than one container which uses it (timing and waiting for ports stuff). You can see the logging output of the container directly in the systemd journal stuff and so on.
docker create was introduced somewhere around docker 1.2 or 1.3. But there is no real python api stuff for this. In the python api you have some instanciation part and then a starting part. But with docker create you have all the parameter stuff -t -i... and with docker start you only have the starting. So there may be problems to implement it with the python api.
Any advance on this feature? Or maybe it is better to actually call docker-compose directly from systemd unit? It looks like a great candidate to do it - the "docker run" command in systemd unit file can get pretty long with a lot of forwarded ports and/or environmental variables being set. I would love to create "typical" small systemd unit files and keep all container runtime parameters in docker-compose.yaml file. Or, if the compose is not supposed to be used like that, let me know...
Activity
chantra commentedon Mar 24, 2015
Isn't this what
docker-compose buildwould do?
cy8aer commentedon Mar 24, 2015
No.
docker-compose buildcreates an image fromDockerfile(likedocker build).If you
docker createthen a new container is instanciated from an image but not started. This looks likedocker run -dand thendocker stopwithout really starting it. So it is like to have adocker-compose upwith creating the containers but not starting them.Why should one need this? If you want to start/stop your containers by systemd (with
ExecStartdoesdocker start -aandExecStopdoesdocker stop) than you would like to have a stopped container after deployment and then systemctl start job (see https://docs.docker.com/articles/host_integration/ -> systemd part). Otherwise you need to stop the container after deployment and before systemd.This is useful if you start e. g. a database container and link it to more than one container which uses it (timing and waiting for ports stuff). You can see the logging output of the container directly in the systemd journal stuff and so on.
docker createwas introduced somewhere around docker 1.2 or 1.3. But there is no real python api stuff for this. In the python api you have some instanciation part and then a starting part. But withdocker createyou have all the parameter stuff-t -i... and withdocker startyou only have the starting. So there may be problems to implement it with the python api.schickling commentedon Apr 22, 2015
+1 for this feature
marklu commentedon May 16, 2015
Another +1 for this feature
rhettl commentedon Jun 11, 2015
👍
peter-leonov commentedon Jun 21, 2015
👍
zimmski commentedon Jun 29, 2015
++
mboussaa commentedon Jul 20, 2015
any advance on this feature ?
marek-obuchowicz commentedon Dec 10, 2015
Any advance on this feature? Or maybe it is better to actually call
docker-composedirectly from systemd unit? It looks like a great candidate to do it - the "docker run" command in systemd unit file can get pretty long with a lot of forwarded ports and/or environmental variables being set. I would love to create "typical" small systemd unit files and keep all container runtime parameters indocker-compose.yamlfile. Or, if the compose is not supposed to be used like that, let me know...Add docker-compose create command.
Add docker-compose create command.
Add docker-compose create command.
Merge pull request docker#1125 from prometheus/repo_sync