docker初级入门篇

Docker容器指南

 

作者

联络方式

lovesea

Q 群:368973565 微信:nuanshoutx

 

 

 

Docker安装

原文链接         https://store.docker.com/editions/community/docker-ce-server-centos?tab=description

 

Docker CE is supported on CentOS 7.3 64-bit.

 

1. Set up the repository

Set up the Docker CE repository on CentOS:

sudo yum install -y yum-utils
 
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
 
sudo yum makecache fast

2. Get Docker CE

Install the latest version of Docker CE onCentOS:

sudo yum -y install docker-ce

Start Docker:

sudo systemctl start docker

3. Test your Docker CE installation

Test your installation:

sudo docker run hello-world

 

 

Docker加速器

 

去官网注册账号  https://dashboard.daocloud.io/services

 

 

curl-sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -shttp://629db2db.m.daocloud.io

 

该脚本可以将 --registry-mirror加入到你的 Docker配置文件 /etc/default/docker中。适用于 Ubuntu14.04DebianCentOS6CentOS7FedoraArch LinuxopenSUSE Leap 42.1,其他版本可能有细微不同

 

Docker常用命令

1.        列出镜像docker images

 

2.     退出容器exit

3.     查询docker中运行的容器 docker ps

4.     显示所有容器:  docker ps–a

5.      如何进入容器 docker exec -it xiaohaibing/javaweb:0.1/bin/bash

6.       删除容器 docker rm /javaweb

7.       登录现有运行容器  docker attachb3a1c9490901 容器ID

8.       创建镜像

docker commit 57c312bbaad1huangyong/javaweb:0.1

 

该容器的 ID 是“57c312bbaad1”,所创建的镜像名是“huangyong/javaweb:0.1”,随后可使用镜像来启动 Java Web 容器。

9.     查看容器详情

docker inspect -f {{.Config.Volumes}}  dev_tomcat2容器id

 

Docker坑

1.        ls: cannot open directory .:Permission denied

宿主机上执行以下命令

$ setenforce 0

 

参考文章

1.      http://www.codeceo.com/article/docker-java-web-runtime.html

2.      http://www.111cn.net/sys/linux/100958.htm

3.      http://www.jb51.net/article/94206.htm

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

半部论语

如果觉得有帮助,打赏鼓励一下

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值