4.4 KiB
Devilbox Documentation
Overview | Installing | Updating | Configuration | Run | Usage | Examples | Technical | Hacking | FAQ
Run
- Start the devilbox
- Foreground Start
- Background Start
- Selective Start
- Stop the devilbox
- Foreground Stop
- Background Stop
- Attach/Detach during run-time
- Attach during run-time
- Detach during run-time
1. Start the devilbox
Starting and stopping containers is done via docker-compose. If you have never worked with it before, have a look at their documentation for an overview, up and stop commands.
1.1 Foreground Start
The normal start will bring up all container defined in docker-compose.yml and will stay in forground making it possible to stop them via Ctrl+c.
$ docker-compose up
1.2 Background Start
Instead of having the docker-compose run stay in foreground, you can also send it to the background by adding -d
as an argument. The following will bring up all container and send docker-compose to background.
$ docker-compose up -d
1.3 Selective Start
There is no need to always bring up all container, if you just need a few at the moment. In order to do so, simply specify the container by name that you actually need.
1.3.1 Starting httpd, php, bind and mysql
# Foreground
$ docker-compose up httpd php bind mysql
# Background
$ docker-compose up -d httpd php bind mysql
Note: httpd
, php
and bind
are base container that will always be started if specified or not. (Defined by depends_on
in docker-compose.yml
). So the above could also be achieved by simply specifying mysql
only.
# Foreground
$ docker-compose up mysql
# Background
$ docker-compose up -d mysql
1.3.2 Starting httpd, php, bind, pgsql and redis
# Foreground
$ docker-compose up httpd php bind pgsql redis
# Background
$ docker-compose up -d httpd php bind pgsql redis
Note: httpd
, php
and bind
are base container that will always be started if specified or not. (Defined by depends_on
in docker-compose.yml
). So the above could also be achieved by simply specifying pgsql
and redis
only.
# Foreground
$ docker-compose up pgsql redis
# Background
$ docker-compose up -d pgsql redis
2. Stop the devilbox
2.1 Foreground stop
If you started up docker compose in foreground mode (without -d
), you can hit ctrl+c
to gracefull stop or twice ctrl+c
to kill the running containers.
Note: Automatically started containers that were not specified (such as http
or php
) will have to be stopped manually via docker-compose down
afterwards.
2.2 Background stop
If you started up docker compose in background mode (with -d
), go back to the devilbox directory (where the docker-compose.yml
file resides and type docker-compose down
to gracefully stop or docker-compose kill
to kill them immediately.
Best pracice would be to start the container in the background (with -d
) and use docker compose down
to gracefully stop all of them.
3. Attach/Detach during run-time
3.1 Attach during run-time
You can also add/attach containers during runtime if you need them. You might have started httpd, php, bind and mysql and decided that you will also require redis. So go ahead and add redis to the running container stack.
# Foreground
$ docker-compose up redis
# Background
$ docker-compose up -d redis
It is recommended to always use background starts, this way you can intially start your desired stack and re-use the current terminal window to start or stop other services.
3.2 Detach during run-time
You can also stop specific containers during runtime if they are not needed anymore. You might have started httpd, php, bind, mysql and redis and decided that redis was not needed. So go ahead and remove redis from the running container stack.
$ docker-compose stop redis