Skip to content

docker-compose create #1125

Closed
Closed

Description

@cy8aer

Possibility to just create but not run containers. This would be a useful feature for systemd based startups.

Activity

  1. chantra commented on Mar 24, 2015

    @chantra

    Isn't this what
    docker-compose build
    would do?

  2. cy8aer commented on Mar 24, 2015

    @cy8aer
    Author

    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.

    Why should one need this? If you want to start/stop your containers by systemd (with ExecStart does docker start -a and ExecStop does docker 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 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.

  3. schickling commented on Apr 22, 2015

    @schickling

    +1 for this feature

  4. marklu commented on May 16, 2015

    @marklu

    Another +1 for this feature

  5. rhettl commented on Jun 11, 2015

    @rhettl

    👍

  6. peter-leonov commented on Jun 21, 2015

    @peter-leonov

    👍

  7. zimmski commented on Jun 29, 2015

    @zimmski

    ++

  8. mboussaa commented on Jul 20, 2015

    @mboussaa

    any advance on this feature ?

  9. marek-obuchowicz commented on Dec 10, 2015

    @marek-obuchowicz

    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...

  10. added a commit that references this issue on Dec 14, 2015
    c8d20db
  11. added 2 commits that reference this issue on Dec 16, 2015
    75c04a1
    3c76d5a
  12. added a commit that references this issue on Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions