- 拉取镜像
docker pull manondidi/mycat - 运行容器
docker run -p 8066:8066 -d --name mycat manondidi/mycat - 容器内部配置拷贝到宿主机
docker cp mycat:/usr/local/mycat/conf/rule.xml /usr/local/home/docker/mycat/conf
docker cp mycat:/usr/local/mycat/conf/server.xml /usr/local/home/docker/mycat/conf
docker cp mycat:/usr/local/mycat/conf/schema.xml /usr/local/home/docker/mycat/conf
- 移除容器,根据刚刚配置做映射,再次运行新容器
docker stop mycat
docker rm mycat
映射(宿主机 to 容器内)
docker run -p 8066:8066 -d --name mycat -v /usr/local/home/docker/mycat/conf/rule.xml:/usr/local/mycat/conf/rule.xml -v /usr/local/home/docker/mycat/conf/server.xml:/usr/local/mycat/conf/server.xml -v /usr/local/home/docker/mycat/conf/schema.xml:/usr/local/mycat/conf/schema.xml --privileged=true manondidi/mycat
查看 docker ps