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.XXX and the one set in 2 / is 192.XXX 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
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
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.