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
This is a CentOS-7 Docker [million12/centos-supervisor](https://registry.hub.docker.com/u/million12/centos-supervisor/) image, perfect in case when you need to launch more then one process inside a container. This image is based on official [centos:centos7](https://registry.hub.docker.com/_/centos/) and it adds only ca. 20MB on top of it.
4
4
5
-
Things included:
5
+
## What's included
6
6
7
-
##### - init scripts
7
+
##### - bootstrap.sh script
8
+
9
+
The container has an **ENTRYPOINT** set to `/config/bootstrap.sh`. It iterates through all `/config/init/*.sh` scripts and runs them, then launches supervisord. See [bootstrap.sh](container-files/config/bootstrap.sh) for details.
8
10
9
-
Add your .sh scripts to `/config/init` to have them executed when container starts. The bootstrap script is configured to run them just before supervisord starts. See [million12/nginx](https://github.com/million12/docker-nginx) for examples.
11
+
By default, the **CMD** option in Dockerfile is empty, but the bootstrap.sh script is configured to run everything which is passed into it. Therefore you can launch it in several ways:
12
+
* detached mode, no argument(s) passed: supervisord starts in foreground mode and stays until container is stopped.
13
+
* detached mode, some argument(s) passed: arguments are executed; supervisord starts in foreground mode and stays until container is stopped.
14
+
* interactive mode with TTY (-it), no argument(s) passed: supervisord starts in background mode; interactive bash waits for user input. Exiting from bash (CMD+D) exists the container.
15
+
* interactive mode with TTY (-it), some argument(s) passed: supervisord starts in background mode, passed command is executed; container exits.
10
16
11
17
##### - supervisord
12
18
13
-
Just add you supervisord config(s) to `/etc/supervisor.d/` directoryto launch your service. For example in your `Dockerfile` you could put:
19
+
Supervisord is installed and loads services to run from `/etc/supervisor.d/` directory. Add your own files there to launch your services. For example in your `Dockerfile` you could put:
Learn more about about [supervisord inside containers on official Docker documentation](https://docs.docker.com/articles/using_supervisord/).
17
23
24
+
##### - init scripts
25
+
26
+
You can add your .sh scripts to `/config/init` directory to have them executed when container starts. The bootstrap script is configured to run them just before supervisord starts. See [million12/nginx](https://github.com/million12/docker-nginx) for example usage.
27
+
18
28
##### - error logging
19
29
20
30
Logfile for supervisord is switched off to avoid logging inside container. Instead, all logs are easily available via `docker logs [container name]`.
21
31
22
-
This is probably the best approach if you'd like to source your logs from outside the container via `docker logs` (also via CoreOS `journald') and you don't want to worry about logging and log management inside your container and/or data volume.
32
+
This is probably the best approach if you would like to source your logs from outside the container via `docker logs` (also via CoreOS `journald') and you do not want to worry about logging and log management inside your container and/or data volume.
23
33
24
34
##### - /data volume
25
35
@@ -36,20 +46,27 @@ Recommended structure:
36
46
37
47
## Usage
38
48
39
-
This container is configured to run your service(s) both in interactive and non-interactive mode (see [bootstrap.sh](config/init/bootstrap.sh) script).
49
+
As explained above, this container is configured to run your service(s) both in interactive and non-interactive modes.
40
50
41
-
`docker run -it million12/centos-supervisor` (interactive)
42
-
`docker run -d million12/centos-supervisor` (detached, non-interactive)
51
+
`docker run -it million12/centos-supervisor`: runs supervisord, then interactive bash shell and waits for user's input. Exiting from the shell kills the container.
52
+
53
+
`docker run -it million12/centos-supervisor ps aux`: runs supervisord, then `ps aux` command inside container and exists.
54
+
55
+
`docker run -it million12/centos-supervisor top`: runs supervisord, then `top` tool. Exiting from top exits the container.
56
+
57
+
`docker run -d million12/centos-supervisor`: detached, runs supervisord in foreground mode and its configured services
58
+
59
+
`docker run -d million12/centos-supervisor touch 'test-file'`: detached, runs `touch 'test-file'` command, then supervisord in foreground mode and its configured services
This work is also inspired by [maxexcloo](https://github.com/maxexcloo)'s work on his [docker images](https://github.com/maxexcloo/Docker). Thanks!
72
+
This work is also inspired by [maxexcloo](https://github.com/maxexcloo)'s work on his [docker images](https://github.com/maxexcloo/Docker). Many thanks!
0 commit comments