My docker containers are build with docker-compose and I automatically start them container on my CentOS 7 system using derivatives from the documentation example::
[Unit] Description=condb container Requires=docker.service After=docker.service [Service] Restart=always ExecStart=/usr/bin/docker start -a condb ExecStop=/usr/bin/docker stop -t 2 condb [Install] WantedBy=local.target
Everything is working fine except for the fact that every time I want to change the container, I stop the services, run
docker-compose up to create the container and then start the services, I forget that
up already starts the containers.
I can adapt my script around this to stop the containers after running
docker-compose, but starting/shutdown takes time and I wonder if there is a way to just create the container without starting it (the
build command just builds,
up does build-create-start according to its help)?