網(wǎng)站: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
運(yùn)行漢化后的服務(wù):
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
--啟動(dòng)一個(gè)測(cè)試的nginx將配置文件復(fù)制到掛載的配置文件下邊/usr/local/nginx/conf[因?yàn)閐ocker不能掛載單個(gè)文件]
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
#配置轉(zhuǎn)發(fā)
net.ipv4.ip_forward=1
#重啟服務(wù)窗怒,讓配置生效
systemctl restart network
#查看是否成功,如果返回為“net.ipv4.ip_forward = 1”則表示成功
sysctl net.ipv4.ip_forward
#重啟docker服務(wù)
service docker restart
#查看運(yùn)行過的容器
docker ps -a
#啟動(dòng)gitlab 容器
docker start gitblab2
#進(jìn)入gitlab容器
docker attach gitlab2