网站:https://www.portainer.io/
1、安装docker
yum install -y yum-utils \
? device-mapper-persistent-data \
? lvm2
yum-config-manager \
? ? --add-repo \
? ? http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum-config-manager \
? ? --add-repo \
? ? https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
yum install docker-ce docker-ce-cli containerd.io -y
yum list docker-ce --showduplicates | sort -r
sudo systemctl enable docker
sudo systemctl status docker
sudo systemctl start docker
2、部署portainer
https://www.portainer.io/installation/
汉化
https://www.quchao.net/Portainer-CN.html
docker search portainer
docker pull portainer/portainer-ce
docker images
docker ps
$ docker volume create portainer_data
$ docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
运行汉化后的服务:
docker ps
docker kill
docker rm
docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data? -v /public:/public portainer/portainer-ce
3、访问
http://192.168.118.100:9000/#!/init/admin
admin/admin#123
4、docker 部署nginx 和tomcat 并管理
docker search nginx
docker pull nginx
docker ps
docker exec -it 19ba07671929 /bin/bash
--启动一个测试的nginx将配置文件复制到挂载的配置文件下边/usr/local/nginx/conf[因为docker不能挂载单个文件]
docker run --name some-nginx -d -p 8080:80 nginx
docker cp some-nginx:/etc/nginx /tmp
--docker cp /tmp some-nginx:/etc/nginx
docker run -e TZ="Asia/Shanghai" -d -p 80:80 --name nginx_web -v /usr/local/nginx/html:/usr/share/nginx/html? -v /usr/local/nginx/conf/conf.d:/etc/nginx/conf.d -v /usr/local/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v /usr/local/nginx/logs:/var/logs/nginx nginx
docker search tomcat
docker pull tomcat
docker images
docker run -d -p 18080:8080 tomcat
docker ps
部署probe.war http://blog.itpub.net/22275400/viewspace-2645002/? tomcat-users.xml参照在源文件上改。
docker exec -it 719c0ba127a9 /bin/bash
docker cp tomcat-users.xml 719c0ba127a9:/usr/local/tomcat/conf/
docker restart? unruffled_pasteur
vi Dockerfile
from tomcat
MAINTAINER genweihua@163.com
RUN rm -rf /usr/local/tomcat/webapps/*
COPY probe.war? /usr/local/tomcat/webapps
COPY tomcat-users.xml? /usr/local/tomcat/conf/
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
docker build -t probe:v1 .
docker run -d -p 28080:8080 probe:v1
--删除镜像
docker? rmi probe:v1
---直接连接docker
vi /usr/lib/systemd/system/docker.service
/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock -H fd:// --containerd=/run/containerd/containerd.sock
systemctl daemon-reload
systemctl restart docker
lsof -i:2375
参考文章:https://blog.csdn.net/qq_29860591/article/details/104981765
https://www.cnblogs.com/sanduzxcvbnm/p/13182948.html
一、Docker之WARNING: IPv4 forwarding is disabled. Networking will not work.
vim /etc/sysctl.conf
#配置转发
net.ipv4.ip_forward=1
#重启服务,让配置生效
systemctl restart network
#查看是否成功,如果返回为“net.ipv4.ip_forward = 1”则表示成功
sysctl net.ipv4.ip_forward
#重启docker服务
service docker restart
#查看运行过的容器
docker ps -a
#启动gitlab 容器
docker start gitblab2
#进入gitlab容器
docker attach gitlab2