Skip to content
This repository was archived by the owner on Jul 2, 2024. It is now read-only.

Commit 33f8d50

Browse files
committed
Merge pull request #62 from jdeathe/master
Release changes ready for centos-6-1.4.2
2 parents 4bfa9ef + cabd01b commit 33f8d50

File tree

7 files changed

+245
-156
lines changed

7 files changed

+245
-156
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# CentOS-6, Apache 2.2, PHP 5.3, PHP Memcached 1.0, PHP APC 3.1.
55
#
66
# =============================================================================
7-
FROM jdeathe/centos-ssh-apache-php:centos-6-1.4.1
7+
FROM jdeathe/centos-ssh-apache-php:centos-6-1.4.2
88

99
MAINTAINER James Deathe <james.deathe@gmail.com>
1010

README.md

Lines changed: 103 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ $ docker run -d \
4040
--env "SERVICE_UNIT_INSTANCE=1" \
4141
--env "APACHE_SERVER_NAME=app-1.local" \
4242
--env "DATE_TIMEZONE=UTC" \
43-
-v /var/services-data/apache-php/app-1:/var/www/app \
43+
-v /var/www/app \
4444
jdeathe/centos-ssh-apache-php-fcgi:latest
4545
```
4646

@@ -63,6 +63,14 @@ To verify the container is initialised and running successfully by inspecting th
6363
$ docker logs apache-php.app-1.1.1
6464
```
6565

66+
The Apache data is persistent across container restarts by setting the data directory ```/var/www/app``` as a data volume. No name or docker_host path was specified so Docker will give it a unique name and store it in ```/var/lib/docker/volumes/```; to find out where the data is stored on the Docker host you can use ```docker inspect```.
67+
68+
```
69+
$ docker inspect \
70+
--format '{{ json (index .Mounts 0).Source }}' \
71+
apache-php.app-1.1.1
72+
```
73+
6674
On first run, the bootstrap script, ([/etc/apache-bootstrap](https://github.com/jdeathe/centos-ssh-apache-php-fcgi/blob/centos-6/etc/apache-bootstrap)), will check if the DocumentRoot directory is empty and, if so, will populate it with the example app scripts and VirtualHost configuration files. If you place your own app in this directory it will not be overwritten but you must ensure to include at least a vhost.conf file and, if enabling SSL a vhost-ssl.conf file too.
6775

6876
The ```apachectl``` command can be accessed as follows.
@@ -75,28 +83,107 @@ $ docker exec -it apache-php.app-1.1.1 apachectl -h
7583

7684
### (Optional) Configuration Data Volume
7785

78-
Create a "data volume" for configuration, this allows you to share the same configuration between multiple docker containers and, by mounting a host directory into the data volume you can override the default configuration files provided.
86+
A configuration "data volume" allows you to share the same configuration files between multiple docker containers. Docker mounts a host directory into the data volume allowing you to edit the default configuration files and have those changes persist.
7987

80-
Make a directory on the docker host for storing container configuration files. This directory needs to contain everything from the directory [etc/services-config](https://github.com/jdeathe/centos-ssh-apache-php-fcgi/blob/centos-6/etc/services-config)
88+
Each service that requires a common set of configuration files could use a single Configuration Volume as illustrated in the following diagram:
8189

8290
```
83-
$ mkdir -p /etc/services-config/apache-php.app-1.1.1
91+
+---------------------------------------------------+
92+
| (Docker Host system) |
93+
| |
94+
| /var/lib/docker/volumes/<volume-name>/_data |
95+
| + |
96+
| | |
97+
| +============*===========+ |
98+
| | Configuration Volume | |
99+
| | Service Container | |
100+
| +============*===========+ |
101+
| | |
102+
| +---------------*---------------+ |
103+
| | | | |
104+
| +=====*=====+ +=====*=====+ +=====*=====+ |
105+
| | Service | | Service | | Service | |
106+
| | Container | | Container | | Container | |
107+
| | (1) | | (2) | | (n) | |
108+
| +===========+ +===========+ +===========+ |
109+
+---------------------------------------------------+
84110
```
85111

86-
Create the data volume, mounting our docker host's configuration directory to */etc/services-config/ssh* in the docker container. Docker will pull the busybox:latest image if you don't already have it available locally.
112+
#### Standard data volume container
113+
114+
Naming of the container's volume is optional, it is possible to leave the naming up to Docker by simply specifying the container path only.
87115

88116
```
89117
$ docker run \
90118
--name volume-config.apache-php.app-1.1.1 \
91-
-v /etc/services-config/ssh.pool-1/ssh:/etc/services-config/ssh \
92-
-v /etc/services-config/apache-php.app-1.1.1/supervisor:/etc/services-config/supervisor \
93-
-v /etc/services-config/apache-php.app-1.1.1/httpd:/etc/services-config/httpd \
94-
-v /etc/services-config/apache-php.app-1.1.1/ssl/certs:/etc/services-config/ssl/certs \
95-
-v /etc/services-config/apache-php.app-1.1.1/ssl/private:/etc/services-config/ssl/private \
96-
busybox:latest \
119+
-v /etc/services-config \
120+
jdeathe/centos-ssh-apache-php-fcgi:latest \
97121
/bin/true
98122
```
99123

124+
To identify the docker host directory path to the volume within the container ```volume-config.apache-php.app-1.1.1``` you can use ```docker inspect``` to view the Mounts.
125+
126+
```
127+
$ docker inspect \
128+
--format '{{ json (index .Mounts 0).Source }}' \
129+
volume-config.apache-php.app-1.1.1
130+
```
131+
132+
#### Named data volume container
133+
134+
To create a named data volume, mounting our docker host's configuration directory /var/lib/docker/volumes/volume-config.apache-php.app-1.1.1 to /etc/services-config in the docker container use the following run command. Note that we use the same image as for the application container to reduce the number of images/layers required.
135+
136+
```
137+
$ docker run \
138+
--name volume-config.apache-php.app-1.1.1 \
139+
-v volume-config.apache-php.app-1.1.1:/etc/services-config \
140+
jdeathe/centos-ssh-apache-php-fcgi:latest \
141+
/bin/true
142+
```
143+
144+
##### Populating Named configuration data volumes
145+
When using named volumes the directory path from the docker host mounts the path on the container so we need to upload the configuration files. The simplest method of achieving this is to upload the contents of the [etc/services-config](https://github.com/jdeathe/centos-ssh-apache-php-fcgi/blob/centos-6/etc/services-config/) directory using ```docker cp```.
146+
147+
```
148+
$ docker cp \
149+
./etc/services-config/. \
150+
volume-config.apache-php.app-1.1.1:/etc/services-config
151+
```
152+
153+
If you don't have a copy of the required configuration files locally you can run a temporary container as the source of the configuration files and use `docker cp` to stream the files into the named data volume container.
154+
155+
```
156+
$ docker run -d \
157+
--name apache-php.tmp \
158+
jdeathe/centos-ssh-apache-php-fcgi:latest \
159+
/bin/sh -c 'while true; do echo -ne .; sleep 1; done';
160+
&& docker cp \
161+
apache-php.tmp:/etc/services-config/. - | \
162+
docker cp - \
163+
volume-config.apache-php.app-1.1.1:/etc/services-config
164+
&& docker rm -f apache-php.tmp
165+
```
166+
167+
#### Editing configuration
168+
169+
To make changes to the configuration files you need a running container that uses the volumes from the configuration volume. To edit a single file you could use the following, where <path_to_file> can be one of the [required configuration files](https://github.com/jdeathe/centos-ssh-apache-php-fcgi/blob/centos-6/README.md#required-configuration-files), or you could run a ```bash``` shell and then make the changes required using ```vi```. On exiting the container it will be removed since we specify the ```--rm``` parameter.
170+
171+
```
172+
$ docker run --rm -it \
173+
--volumes-from volume-config.apache-php.app-1.1.1 \
174+
jdeathe/centos-ssh-apache-php-fcgi:latest \
175+
vi /etc/services-config/<path_to_file>
176+
```
177+
178+
##### Required configuration files
179+
180+
The following configuration files are required to run the application container and should be located in the directory /etc/services-config/.
181+
182+
- [httpd/conf/httpd.conf](https://github.com/jdeathe/centos-ssh-apache-php-fcgi/blob/centos-6/etc/services-config/httpd/conf/httpd.conf)
183+
- [httpd/conf.d/php.conf](https://github.com/jdeathe/centos-ssh-apache-php-fcgi/blob/centos-6/etc/services-config/httpd/conf.d/php.conf)
184+
- [httpd/conf.d/ssl.conf](https://github.com/jdeathe/centos-ssh-apache-php-fcgi/blob/centos-6/etc/services-config/httpd/conf.d/ssl.conf)
185+
- [supervisor/supervisord.conf](https://github.com/jdeathe/centos-ssh-apache-php-fcgi/blob/centos-6/etc/services-config/supervisor/supervisord.conf)
186+
100187
### Running
101188

102189
To run the a docker container from this image you can use the included [run.sh](https://github.com/jdeathe/centos-ssh-apache-php-fcgi/blob/centos-6/run.sh) and [run.conf](https://github.com/jdeathe/centos-ssh-apache-php-fcgi/blob/centos-6/run.conf) scripts. The helper script will stop any running container of the same name, remove it and run a new daemonised container on an unspecified host port. Alternatively you can use the following methods to make the http service available on ports 8080 of the docker host.
@@ -124,7 +211,7 @@ $ docker run -d \
124211
--env "SERVICE_USER=app" \
125212
--env "SERVICE_USER_GROUP=app-www" \
126213
--env "SERVICE_USER_PASSWORD=" \
127-
-v /var/services-data/apache-php/app-1:/var/www/app-1 \
214+
-v volume-data.apache-php.app-1.1.1:/var/www/app-1 \
128215
jdeathe/centos-ssh-apache-php-fcgi:latest
129216
```
130217

@@ -145,7 +232,7 @@ $ docker run -d \
145232
--env "APACHE_SERVER_NAME=app-1.local" \
146233
--env "DATE_TIMEZONE=UTC" \
147234
--volumes-from volume-config.apache-php.app-1.1.1 \
148-
-v /var/services-data/apache-php/app-1:/var/www/app \
235+
-v volume-data.apache-php.app-1.1.1:/var/www/app \
149236
jdeathe/centos-ssh-apache-php-fcgi:latest
150237
```
151238

@@ -235,7 +322,7 @@ $ docker run -d \
235322
--env "APACHE_SERVER_NAME=app-1.local" \
236323
--env "APACHE_MOD_SSL_ENABLED=true" \
237324
--env "DATE_TIMEZONE=UTC" \
238-
-v /var/services-data/apache-php/app-1:/var/www/app \
325+
-v volume-data.apache-php.app-1.1.1:/var/www/app \
239326
jdeathe/centos-ssh-apache-php-fcgi:latest
240327
```
241328

@@ -246,7 +333,7 @@ The home directory of the service user and parent directory of the Apache Docume
246333
```
247334
...
248335
--env "APP_HOME_DIR=/var/www/app-1" \
249-
-v /var/services-data/apache-php/app-1:/var/www/app-1 \
336+
-v volume-data.apache-php.app-1.1.1:/var/www/app-1 \
250337
...
251338
```
252339

@@ -276,7 +363,7 @@ Use the ```SERVICE_USER```, ```SERVICE_USER_GROUP``` and ```SERVICE_USER_PASSWOR
276363

277364
### Custom Configuration
278365

279-
If using the optional data volume for container configuration you are able to customise the configuration. In the following examples your custom docker configuration files should be located on the Docker host under the directory ```/etc/service-config/<container-name>/``` where ```<container-name>``` should match the applicable container name such as "apache-php.app-1.1.1" in the examples.
366+
If using the optional data volume for container configuration you are able to customise the configuration. In the following examples your custom docker configuration files should be located on the Docker host under the directory ```/var/lib/docker/volumes/<volume-name>/``` where ```<container-name>``` should match the applicable container name such as "apache-php.app-1.1.1" if using named volumes or will be an ID generated automatically by Docker. To identify the correct path on the Docker host use the ```docker inspect``` command.
280367

281368
#### [httpd/apache-bootstrap.conf](https://github.com/jdeathe/centos-ssh-apache-php-fcgi/blob/centos-6/etc/services-config/httpd/apache-bootstrap.conf)
282369

@@ -305,7 +392,3 @@ To override the SSLCertificateKeyFile add it to your config directory using the
305392
#### [supervisor/supervisord.conf](https://github.com/jdeathe/centos-ssh-apache-php-fcgi/blob/centos-6/etc/services-config/supervisor/supervisord.conf)
306393

307394
The supervisor service's configuration can also be overridden by editing the custom supervisord.conf file. It shouldn't be necessary to change the existing configuration here but you could include more [program:x] sections to run additional commands at startup.
308-
309-
### Apache DocumentRoot - Data Directory
310-
311-
In the previous example Docker run commands we mapped the Docker host directory ```/var/services-data/apache-php/app-1``` to ```/var/www/app``` in the Docker container, where ```/var/services-data/``` is the directory used to store persistent files and the subdirectory is used by an individual app's named container(s), ```apache-php.app-1.1.1```, in the previous examples.

apache-php.app-1.1.1@8080.service

Lines changed: 47 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,16 @@
22
# Create a data container for the configuration volume:
33
# docker run -v /config --name volume-config.<service-name> busybox /bin/true
44
#
5-
# Optional configuration volume install:
6-
# mkdir -p /etc/services-config/<service-name>/{httpd,supervisor,ssl/{certs,private}}
7-
# cp <container-path>/etc/services-config/supervisor/supervisord.conf /etc/services-config/<service-name>/supervisor/supervisord.conf
8-
# cp <container-path>/etc/services-config/httpd/conf/httpd.conf /etc/services-config/<service-name>/httpd/conf/httpd.conf
9-
# cp <container-path>/etc/services-config/httpd/conf.d/php.conf /etc/services-config/<service-name>/httpd/conf.d/php.conf
10-
# cp <container-path>/etc/services-config/httpd/conf.d/ssl.conf /etc/services-config/<service-name>/httpd/conf.d/ssl.conf
11-
#
125
# To install:
136
# sudo cp <container-path>/<service-name>@<port>.service /etc/systemd/system/
147
# sudo systemctl daemon-reload
158
# sudo systemctl enable /etc/systemd/system/<service-name>@<port>.service
169
#
1710
# Start using:
18-
# sudo systemctl restart <service-name>@<port>.service
11+
# sudo systemctl [start|stop|restart|kill|status] <service-name>@<port>.service
12+
#
13+
# Debugging:
14+
# journalctl -fn 50 u <service-name>@<port>.service
1915
# -----------------------------------------------------------------------------
2016

2117
[Unit]
@@ -29,59 +25,70 @@ Requires=etcd2.service
2925
Restart=on-failure
3026
RestartSec=30
3127
TimeoutStartSec=1200
32-
Environment="MOUNT_PATH_CONFIG=/etc/services-config"
33-
Environment="MOUNT_PATH_DATA=/var/services-data"
28+
Environment="DOCKER_IMAGE_PACKAGE_PATH=/var/services-packages"
3429
Environment="DOCKER_IMAGE_NAME=jdeathe/centos-ssh-apache-php-fcgi"
3530
Environment="DOCKER_IMAGE_TAG=centos-6-1.4.1"
3631
Environment="SERVICE_UNIT_APP_GROUP=app-1"
3732
Environment="SERVICE_UNIT_LOCAL_ID=1"
3833
Environment="SERVICE_UNIT_INSTANCE=1"
34+
Environment="VOLUME_CONFIG_ENABLED=false"
35+
Environment="VOLUME_CONFIG_NAMED=false"
36+
Environment="VOLUME_CONFIG_NAME=volume-config.%p"
37+
Environment="VOLUME_DATA_NAME=volume-data.%p"
3938
Environment="APACHE_SERVER_ALIAS=app-1"
4039
Environment="APACHE_SERVER_NAME=app-1.local"
4140
Environment="DATE_TIMEZONE=UTC"
4241

43-
# Create a data container for the configuration volume
42+
# Initialisation: Load image from local storage if available, otherwise pull.
4443
ExecStartPre=/bin/sudo /bin/bash -c \
45-
"if [[ busybox != $(/usr/bin/docker images | /bin/grep -e '^busybox[ ]\{1,\}' | /bin/grep -o 'busybox') ]]; then \
46-
if [[ -f /var/services-packages/busybox.latest-1.0.0.tar.xz ]]; then \
47-
/usr/bin/xz /var/services-packages/busybox.latest-1.0.0.tar.xz | /usr/bin/docker load; \
44+
"if [[ ${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} != $(/usr/bin/docker images | awk -v FS='[ ]+' -v pattern=\"^${DOCKER_IMAGE_NAME}[ ]+${DOCKER_IMAGE_TAG} \" '$0 ~ pattern { print $1\":\"$2; }') ]]; then \
45+
if [[ -f ${DOCKER_IMAGE_PACKAGE_PATH}/${DOCKER_IMAGE_NAME}.${DOCKER_IMAGE_TAG}.tar.xz ]]; then \
46+
/usr/bin/xz -dc ${DOCKER_IMAGE_PACKAGE_PATH}/${DOCKER_IMAGE_NAME}.${DOCKER_IMAGE_TAG}.tar.xz | /usr/bin/docker load; \
4847
else \
49-
/usr/bin/docker pull busybox:latest; \
50-
fi; \
51-
fi; \
52-
if [[ -n $(/usr/bin/find ${MOUNT_PATH_CONFIG}/%p/supervisor -maxdepth 1 -type f) ]] && [[ -n $(/usr/bin/find ${MOUNT_PATH_CONFIG}/%p/httpd -maxdepth 1 -type f) ]]; then \
53-
if [[ volume-config.%p != $(/usr/bin/docker ps -a | /bin/awk -v pattern='^volume-config.%p$' '$NF ~ pattern { print $NF; }') ]]; then \
54-
/usr/bin/docker run \
55-
--name volume-config.%p \
56-
-v ${MOUNT_PATH_CONFIG}/ssh.pool-1/ssh:/etc/services-config/ssh \
57-
-v ${MOUNT_PATH_CONFIG}/%p/supervisor:/etc/services-config/supervisor \
58-
-v ${MOUNT_PATH_CONFIG}/%p/httpd:/etc/services-config/httpd \
59-
-v ${MOUNT_PATH_CONFIG}/%p/ssl/certs:/etc/services-config/ssl/certs \
60-
-v ${MOUNT_PATH_CONFIG}/%p/ssl/private:/etc/services-config/ssl/private \
61-
busybox:latest \
62-
/bin/true; \
48+
/usr/bin/docker pull ${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}; \
6349
fi; \
6450
fi"
6551

66-
# Initialisation: Pull or build image if required
52+
# Create a data container for the configuration volume
6753
ExecStartPre=/bin/sudo /bin/bash -c \
68-
"if [[ ${DOCKER_IMAGE_NAME} != $(/usr/bin/docker images | /bin/grep -e \\\"^${DOCKER_IMAGE_NAME}[ ]\{1,\}\\\" | /bin/grep -o \\\"${DOCKER_IMAGE_NAME}\\\") ]]; then \
69-
if [[ -f /var/services-packages/${DOCKER_IMAGE_NAME}.${DOCKER_IMAGE_TAG}.tar.xz ]]; then \
70-
/usr/bin/xz -dc /var/services-packages/${DOCKER_IMAGE_NAME}.${DOCKER_IMAGE_TAG}.tar.xz | /usr/bin/docker load; \
71-
else \
72-
/usr/bin/docker pull ${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}; \
54+
"if [[ ${VOLUME_CONFIG_ENABLED} == true ]] && [[ ${VOLUME_CONFIG_NAMED} == true ]]; then \
55+
if [[ ${VOLUME_CONFIG_NAME} != $(/usr/bin/docker ps -a | /bin/awk -v pattern=\"^${VOLUME_CONFIG_NAME}$\" '$NF ~ pattern { print $NF; }') ]]; then \
56+
/usr/bin/docker run \
57+
--name ${VOLUME_CONFIG_NAME}.tmp \
58+
${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} \
59+
/bin/sh -c 'while true; do echo -ne .; sleep 1; done'; \
60+
/usr/bin/docker run \
61+
--name ${VOLUME_CONFIG_NAME} \
62+
-v ${VOLUME_CONFIG_NAME}:/etc/services-config \
63+
${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} \
64+
/bin/true; \
65+
/usr/bin/docker cp ${VOLUME_CONFIG_NAME}.tmp:/etc/services-config/. \
66+
/var/lib/docker/volumes/${VOLUME_CONFIG_NAME}/_data; \
67+
/usr/bin/docker kill ${VOLUME_CONFIG_NAME}.tmp; \
68+
fi; \
69+
elif [[ ${VOLUME_CONFIG_ENABLED} == true ]] && [[ ${VOLUME_CONFIG_NAMED} != true ]]; then \
70+
if [[ ${VOLUME_CONFIG_NAME} != $(/usr/bin/docker ps -a | /bin/awk -v pattern=\"^${VOLUME_CONFIG_NAME}$\" '$NF ~ pattern { print $NF; }') ]]; then \
71+
/usr/bin/docker run \
72+
--name ${VOLUME_CONFIG_NAME} \
73+
-v /etc/services-config \
74+
${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} \
75+
/bin/true; \
7376
fi; \
7477
fi"
7578

76-
# Startup: Remove existing container (and stop if running) so it is re-created on startup but not removed on exit - to allow debugging if required
77-
ExecStart=/bin/sudo /bin/bash -c \
79+
# Remove existing container (and stop if running). This allows it to
80+
# be re-created on startup but not removed on exit as with --rm.
81+
ExecStartPre=/bin/sudo /bin/bash -c \
7882
"if [[ %p == $(/usr/bin/docker ps -a | /bin/awk -v pattern='^%p$' '$NF ~ pattern { print $NF; }') ]]; then \
7983
if [[ %p == $(/usr/bin/docker ps | /bin/awk -v pattern='^%p$' '$NF ~ pattern { print $NF; }') ]]; then \
8084
/usr/bin/docker stop %p; \
8185
fi; \
8286
/usr/bin/docker rm %p; \
83-
fi; \
84-
if [[ volume-config.%p == $(/usr/bin/docker ps -a | /bin/awk -v pattern='^volume-config.%p$' '$NF ~ pattern { print $NF; }') ]]; then \
87+
fi"
88+
89+
# Startup
90+
ExecStart=/bin/sudo /bin/bash -c \
91+
"if [[ ${VOLUME_CONFIG_NAME} == $(/usr/bin/docker ps -a | /bin/awk -v pattern=\"^${VOLUME_CONFIG_NAME}$\" '$NF ~ pattern { print $NF; }') ]]; then \
8592
/usr/bin/docker run \
8693
--name %p \
8794
-p %i:80 \
@@ -93,7 +100,7 @@ ExecStart=/bin/sudo /bin/bash -c \
93100
--env APACHE_SERVER_NAME=${APACHE_SERVER_NAME} \
94101
--env DATE_TIMEZONE=${DATE_TIMEZONE} \
95102
--volumes-from volume-config.%p \
96-
-v ${MOUNT_PATH_DATA}/apache-php/${SERVICE_UNIT_APP_GROUP}:/var/www/app \
103+
-v ${VOLUME_DATA_NAME}:/var/www/app \
97104
${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}; \
98105
else \
99106
/usr/bin/docker run \
@@ -115,7 +122,7 @@ ExecStart=/bin/sudo /bin/bash -c \
115122
--env SERVICE_USER_GROUP=app-www \
116123
--env SERVICE_USER_PASSWORD= \
117124
--env SUEXECUSERGROUP=false \
118-
-v ${MOUNT_PATH_DATA}/apache-php/${SERVICE_UNIT_APP_GROUP}:/var/www/app \
125+
-v ${VOLUME_DATA_NAME}:/var/www/app \
119126
${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}; \
120127
fi"
121128

build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ show_docker_image ()
2020
NAME_PARTS[1]='latest'
2121
fi
2222

23-
docker images | grep -e "^${NAME_PARTS[0]}[ ]\{1,\}${NAME_PARTS[1]}"
23+
docker images | awk -v FS='[ ]+' \
24+
-v pattern="^${NAME_PARTS[0]}[ ]+${NAME_PARTS[1]} " \
25+
'$0 ~ pattern { print $0; }'
2426
}
2527

2628
echo "Building ${DOCKER_IMAGE_REPOSITORY_NAME}"

0 commit comments

Comments
 (0)