更新安装源
yum -y upgrade
yum -y install net-tools
自行安装docker,可参照官网安装
拉取mysql容器
docker pull mysql
运行容器
docker run --name mysql --restart unless-stopped -p 3306:3306 -v /opt/docker/mysql/data:/var/lib/mysql -v /opt/docker/mysql/logs:/var/log/mysql -v /opt/docker/mysql/conf:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=123456 -e TZ=Asia/Shanghai -d mysql:latest
redis
docker run --name redis --restart unless-stopped -p 6379:6379 -v /opt/docker/redis/data:/data -d redis:latest redis-server --appendonly yes --hz 100 --notify-keyspace-events Ex --requirepass 123123
容器之间访问
docker run --name centos --privileged=true --restart unless-stopped --add-host www.iu520.com:192.168.0.102 -itd centos:latest
--add-host 自定义域名解析,即可直接访问宿主机IP
gitlab
docker run --name gitlab --restart unless-stopped --privileged=true -p 10443:443 -p 1080:80 -p 1022:22 -v /opt/docker/gitlab/data:/var/opt/gitlab -v /opt/docker/gitlab/conf:/etc/gitlab -v /opt/docker/gitlab/logs:/var/log/gitlab --shm-size 512m -d gitlab/gitlab-ce
转载请注明出处,谢谢了。