码迷,mamicode.com
首页 > 其他好文 > 详细

docker学习记录

时间:2019-07-10 11:15:54      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:mct   run   桥接   data   doc   star   port   lin   enc   

------------docker---------------------------------------------------------------------------------------------
wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-17.09.0.ce-1.el7.centos.x86_64.rpm

yum localinstall docker-ce-17.09.0.ce-1.el7.centos.x86_64.rpm -y

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

-------jenkins-------------------------------------------------------------------------------------------------
nohup java -jar jenkins.war --httpPort=8080 &
docker run -dit -p 80:8080 -p 50000:50000 --name jenkins -v /opt/jenkins:/var/jenkins_home --privileged=true --restart always jenkins/jenkins

-----gitlab---------------------------------------------------------------------------------------------------
[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key

docker run -dit -p 2222:22 --restart=always -p 8080:8080 -p80:80 -p 8443:443 -v /home/gitlab/config:/etc/gitlab -v

/home/gitlab/logs:/var/log/gitlab -v /home/gitlab/data:/var/opt/gitlab --restart always --name gitlab

gitlab/gitlab-ce
vim /etc/gitlab/gitlab.rb --> external_url ‘http://192.168.1.12
git clone ssh://git@192.168.1.15:2222/python/python-project.git
上一行加ssh表示容器映射的端口是2222,非22要加ssh

-------docker---------------------------------------------------------------------------------------------------
echo net.ipv4.ip_forward=1 > /usr/lib/sysctl.d/00-system.conf && systemctl restart network && systemctl restart

docker
#容器提交成为镜像的时候记住 -v 挂载的目录不会带走
#容器导出时候,再导入为镜像时候启动要加bash,且启动要进入启动nginx
docker tag nginx:latest xuewenchang123/nginx:latest 镜像标签
docker push xuewenchang123/nginx:latest 镜像上传/下载
docker commit [container id] [nginx:latest] 容器提交成镜像 -m"description" -a"name"
docker save -o nginx.tar nginx:latest 镜像导出 --output
docker load -i nginx.tar 镜像导入 --input
docker export [容器 id] > [nginx.tar] 容器快照导出为tar文件
cat nginx.tar | docker import - nginx:latest 容器快照/模板导入为镜像(need start container)
find / -name [container id] vim hostconfig.json vim config.v2.json 修改/添加容器端口
docker run --privileged -dti --name test1 centos /usr/sbin/init ssh

--------docker network -----------------------------------------------------------------------------------------
docker network create --driver bridge networ-xue bridge网络==默认桥接网络
docker run -dit --name test1 --network networ-xue -p802:80 nginx bridge网络创建容器

docker学习记录

标签:mct   run   桥接   data   doc   star   port   lin   enc   

原文地址:https://blog.51cto.com/982439641/2418751

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!