Docker Community Forums

Share and learn in the Docker community.

After Restarting Docker Service,Container Stopped Automatically When Try to Start It in Linux

docker

(Latou) #1

Hello Everyone,
I wanna build some PXC docker containers in Linux (CentOS 7),
This is the docker image name:
#######Image Name########
percona/percona-xtradb-cluster
########################
This is my commands:
#######First Container########
docker run -it -v v1:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root -e CLUSTER_NAME=cluster1 -e XTRABACKUP_PASSWORD=root --net=net1 --name=note1 --ip=172.18.0.2 --restart=always -p 3307:3306 docker-pxc
#######Second Container#####
docker run -it -v v2:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root -e CLUSTER_NAME=cluster1 -e XTRABACKUP_PASSWORD=root --net=net1 --name=note2 --ip=172.18.0.3 -p 3308:3306 -e CLUSTER_JOIN=172.18.0.2 --restart=always docker-pxc
#########################
When I first run these commands, it was no problem.
But when I restart docker’s service and try to start those containers, them will stop automatically after a few seconds.
I search a lot of doc, but also cant fix this issue.
Thanks all, I need your help


(David Maze) #2

Well, what does docker logs say?

Is trying to override Docker’s IP address assignment causing trouble? Does it work if you remove the --ip options (and set up the containers to talk to each other using their --name as DNS names)?