skip to Main Content

I have mounted two identical docker on two ubuntu vps with docker-compose.
The concern is that the first one works well, and the pilces dialogue between it, the second one not.
What I see is that the ip set by default in 1 / is 172.X.X.X and the one set in 2 / is 192.X.X.X.
I am on virgin vps, no particular configuration file … but I do not see how this is possible.
Here is the docker-compose

version: '2.4'
services:
  redis:
    image: redis:alpine



 db:
    image: mariadb:10.5
    working_dir: /application
    command: [mysqld, --character-set-server=utf8mb4, --collation-server=utf8mb4_unicode_ci, --innodb-file-format=Barracuda, --innodb-large-prefix=1, --innodb-file-per-table=1]
    volumes:
      - pimcore-demo-database:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=ROOT
      - MYSQL_DATABASE=pimcore
      - MYSQL_USER=pimcore
      - MYSQL_PASSWORD=pimcore

  php:
    image: pimcore/pimcore:PHP8.0-apache
    volumes:
      - .:/var/www/html:cached
    ports:
     - 80:80
     - 443:443
    environment:
     - APACHE_DOCUMENT_ROOT=/var/www/html/public

  php-debug:
    image: pimcore/pimcore:PHP8.0-apache-debug
    volumes:
      - .:/var/www/html:cached
    ports:
     - 88:80
    environment:
      - PHP_IDE_CONFIG="serverName=localhost"
      - APACHE_DOCUMENT_ROOT=/var/www/html/public

volumes:
  pimcore-demo-database:

thank you in advance

2

Answers


  1. Chosen as BEST ANSWER

    Ok solution :

    sudo snap remove docker
    sudo rm -R /var/lib/docker
    sudo apt-get remove docker docker-engine docker.io
    sudo apt-get update
    https://doc.ubuntu-fr.org/docker
    systemctl start docker
    

  2. Try to add networking config inside your compose yml to use specific IPs, like following:

    more infos on https://docs.docker.com/compose/networking/#use-a-pre-existing-network

    version: '2.4'
    services:
      redis:
        image: redis:alpine
    
     db:
        image: mariadb:10.5
        working_dir: /application
        command: [mysqld, --character-set-server=utf8mb4, --collation-server=utf8mb4_unicode_ci, --innodb-file-format=Barracuda, --innodb-large-prefix=1, --innodb-file-per-table=1]
        volumes:
          - pimcore-demo-database:/var/lib/mysql
        environment:
          - MYSQL_ROOT_PASSWORD=ROOT
          - MYSQL_DATABASE=pimcore
          - MYSQL_USER=pimcore
          - MYSQL_PASSWORD=pimcore
        networks:           # <-- Add this line
          - you_own_network # <-- Add this line
    
      php:
        image: pimcore/pimcore:PHP8.0-apache
        volumes:
          - .:/var/www/html:cached
        ports:
         - 80:80
         - 443:443
        environment:
         - APACHE_DOCUMENT_ROOT=/var/www/html/public
        networks:           # <-- Add this line
          - you_own_network # <-- Add this line
    
      php-debug:
        image: pimcore/pimcore:PHP8.0-apache-debug
        volumes:
          - .:/var/www/html:cached
        ports:
         - 88:80
        environment:
          - PHP_IDE_CONFIG="serverName=localhost"
          - APACHE_DOCUMENT_ROOT=/var/www/html/public
        networks:           # <-- Add this line
          - you_own_network # <-- Add this line
    
    volumes:
      pimcore-demo-database:
    
    networks:               # <-- Add this block
      you_own_network:
        driver: bridge
        ipam:
          driver: default
          config:
            - subnet: 172.123.123.0/24
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search