J
J
Jiestie2019-06-04 18:39:54
Software testing
Jiestie, 2019-06-04 18:39:54

There is a dev-docker-compose, I want to make testing-docker-compose, but I need the database volumes to be new - not to use the previous ones - how?

i have dev-docker-compose.yml there are several servers, several databases: postgres, redis etc...
now i want to create test-docker-compose.yml - i changed container/service names, for example now like this:
postgres:
image: postgres
restart: always
ports:
- "5432:5432"
volumes:
- postgres:/var/lib/postgresql/data
and now i have changed it to
test_postgres:
image: postgres
restart: always
ports:
- "5432: 5432"
volumes:
- test_postgres:/var/lib/postgresql/data
but when I go to the database using navicat or dbeaver, no matter what, I see the same data that was with the first version of dev-docker-compose.
that is, how do I create all the same services with the help of a new compose. but for the databases to be new? this is for running testing. I don't need to change or remove the bases of the previous compose. just skip tests and everything in new empty bases

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2019-06-04
@deepblack

Explicitly specify the port:

version: '3.5'
services:
  postgres1:
    image: postgres:9.6
    environment:
      POSTGRES_PASSWORD: example1
    ports: 
      - "5000:5432"

  postgres2:
    image: postgres:9.6
    environment:
      POSTGRES_PASSWORD: example2
    ports:
      - "5001:5432"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question