Я использую Docker версии 19.03.3 с Docker Swarm и реестром Docker. Я хочу знать, как я могу использовать то же изображение, но с другой сборкой.
my swarm.yml:
version: '3'
services:
db:
image: 127.0.0.1:5000/postgres:11.5
build: docker-compose.d/postgres
environment:
- PG_MAX_WAL_SENDERS=8
- PG_WAL_KEEP_SEGMENTS=8
- PGDATA=/var/lib/postgresql/data/pgdata
- POSTGRES_USER=user
- POSTGRES_PASSWORD=password
deploy:
placement:
constraints:
- node.role == manager
db-slave:
build: docker-compose.d/postgres/slave
image: 127.0.0.1:5000/postgres:11.5
environment:
- PGDATA=/var/lib/postgresql/data/pgdata
- REPLICATE_FROM=db
- POSTGRES_USER=user
- POSTGRES_PASSWORD=password
deploy:
placement:
constraints:
- node.role == manager
depends_on:
- db
docker images:
127.0.0.1:5000/postgres 11.5 839a428f8eac 4 days ago 848MB
127.0.0.1:5000/postgres <none> e5636a8fc5f0 4 days ago 848MB
127.0.0.1:5000/postgres <none> 6c1932b5707c 4 days ago 848MB
postgres 11.5 5f1485c70c9a 5 days ago 293MB
registry <none> f32a97de94e1 7 months ago 25.8MB
dockerфайл db:
FROM postgres:11.5
COPY ./cluster/ /docker-entrypoint-initdb.d/
RUN apt-get update -y
RUN apt-get install postgis -y
docker file db-slave:
FROM postgres:11.5
RUN apt-get update -y
RUN apt-get install postgis iputils-ping -y
COPY setup-replication.sh /docker-entrypoint-initdb.d/
COPY docker-entrypoint.sh /docker-entrypoint.sh
COPY postgres.sql /docker-entrypoint-initdb.d/
RUN chmod +x /docker-entrypoint-initdb.d/setup-replication.sh /docker-entrypoint.sh
Они оба изображения postgres: 11.5 из реестра, и это создает проблему, потому что я хочу использовать postgres 11.5 на обоих, но чтобы использовать другую сборку, так как мне нужно предварительно сформировать другой процесс сборки на них обоих. один копирует файл, а другой нет. (например), как я могу это сделать?
реестр сохранить обе сборки как один postgres: 11.5