docker-compose up -d - построить "$ @" построения изображений с неправильными именами
Я хотел бы создать образы Docker со следующими именами:
denpal_cli:latest
denpal_php:latest
denpal_nginx:latest
К сожалению, изображения Docker дают такой результат:
workspace_php:latest
workspace_nginx:latest
denpal:latest
Таким образом, я не могу отправить их в паб Docker с их собственными именами, или я должен сделать хаккей:
docker tag denpal:latest denpal_cli:latest
docker tag workspace_php:latest denpal_php:latest
docker tag workspace_nginx:latest denpal_nginx:latest
Docker ps показывает это как результат:
workspace_cli_1 /sbin/tini -- /lagoon/entr ... Up 9000/tcp
workspace_mariadb_1 /sbin/tini -- /lagoon/entr ... Up 0.0.0.0:32768->3306/tcp
workspace_nginx_1 /sbin/tini -- /lagoon/entr ... Up 8080/tcp
workspace_php_1 /sbin/tini -- /lagoon/entr ... Up 9000/tcp
workspace_redis_1 /sbin/tini -- /lagoon/entr ... Up 6379/tcp
workspace_solr_1 /sbin/tini -- /lagoon/entr ... Up 0.0.0.0:32769->8983/tcp
workspace_varnish_1 /sbin/tini -- /lagoon/entr ... Up 8080/tcp
Это файл docker-compose:
version: '2.3'
x-test-project:
# Project name (leave `&test-project` when you edit this)
&test-project denpal
x-volumes:
&default-volumes
# Define all volumes you would like to have real-time mounted into the docker containers
volumes:
- .:/app:delegated
x-environment:
&default-environment
TEST_PROJECT: *test-project
x-user:
&default-user
# The default user under which the containers should run. Change this if you are on linux and run with another user than id `1000`
user: '1000'
services:
cli: # cli container, will be used for executing composer and any local commands (drush, drupal, etc.)
build:
context: .
dockerfile: Dockerfile.cli
image: *test-project # this image will be reused as `CLI_IMAGE` in subsequent Docker builds
<< : *default-volumes # loads the defined volumes from the top
user: root
environment:
<< : *default-environment # loads the defined environment variables from the top
nginx:
build:
context: .
dockerfile: Dockerfile.nginx
args:
CLI_IMAGE: *test-project # Inject the name of the cli image
<< : *default-volumes # loads the defined volumes from the top
<< : *default-user # uses the defined user from top
depends_on:
- cli # basically just tells docker-compose to build the cli first
networks:
- test-network
- default
php:
build:
context: .
dockerfile: Dockerfile.php
args:
CLI_IMAGE: *test-project
<< : *default-volumes # loads the defined volumes from the top
<< : *default-user # uses the defined user from top
depends_on:
- cli # basically just tells docker-compose to build the cli first
environment:
<< : *default-environment # loads the defined environment variables from the top
mariadb:
image: mariadb-drupal
ports:
- "3306" # exposes the port 3306 with a random local port, find it with `docker-compose port mariadb 3306`
<< : *default-user # uses the defined user from top
environment:
<< : *default-environment
redis:
image: redis
<< : *default-user # uses the defined user from top
environment:
<< : *default-environment
solr:
image: solr:6.6-drupal
<< : *default-user # uses the defined user from top
ports:
- "8983" # exposes the port 8983 with a random local port, find it with `docker-compose port solr 8983`
environment:
<< : *default-environment
varnish:
image: varnish-drupal
links:
- nginx # links varnish to the nginx in this docker-compose project, or it would try to connect to any nginx running in docker
<< : *default-user # uses the defined user from top
environment:
<< : *default-environment
VARNISH_BYPASS: "true" # by default we bypass varnish, change to 'false' or remove in order to tell varnish to cache if possible
networks:
- test-network
- default
networks:
test-network:
external: true
Рабочая область - это имя каталога Jenkins, из которого происходит сборка.
Мне бы также хотелось, чтобы контейнеры подключались к сети с именами denpal_cli_1, denpal_mariadb_1 и т. Д.
Возможно ли это?