安装 docker 先看下 centos 版本
- [root@localhost ~]# uname -r
- 3.10.0-514.21.2.el7.x86_64
第一个命令, 下载
wget -qO- https://get.docker.com/ | sh
下载完后, docker 默认情况是允许 root 去运行, 所有建议添加一个用户到 docker 组
先查看用户组
cat /etc/group
我们添加一个用户
- [root@localhost docker]#usermod - aG docker songguojun
- #groups 查看当前登录用户的组内成员
查看加入情况
cat /etc/group
查看 docker 是否安装成功
docker info
如果出现下面命令
说明 docker 服务没有启动
我们启动下
service docker start
在执行 docker info
docker 安装成功
我们可以直接输入 docker 命令 查看 docker 命令的选项
我们看到里面有个 run 参数, 意思是在一个新容器中执行命令, 可以单独查看这个参数意思
- [root@localhost ~]# docker run --help
- Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
- Run a command in a new container
- Options:
- --add-host list Add a custom host-to-IP mapping (host:ip)
- -a, --attach list Attach to STDIN, STDOUT or STDERR
- --blkio-weight uint16 Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)
- --blkio-weight-device list Block IO weight (relative device weight) (default [])
- --cap-add list Add Linux capabilities
- --cap-drop list Drop Linux capabilities
- --cgroup-parent string Optional parent cgroup for the container
- --cidfile string Write the container ID to the file
- --cpu-period int Limit CPU CFS (Completely Fair Scheduler) period
- --cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota
- --cpu-rt-period int Limit CPU real-time period in microseconds
来源: http://www.bubuko.com/infodetail-2497351.html