docker学习记录
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker学习记录相关的知识,希望对你有一定的参考价值。
------------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://[email protected]: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学习记录的主要内容,如果未能解决你的问题,请参考以下文章