分享

docker入门一:docker安装(在线跟离线)

 想不出一个昵称 2020-02-23

一.在线安装

1.安装依赖

yum install -y yum-utils device-mapper-persistent-data lvm2

2.添加软件源

1
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

3.安装docker-ce

1
yum  -y install docker-ce

4.启动服务

systemctl start docker

 

5.查看docker版本信息

docker version

 

二.离线安装

1.登录镜像网站

 

https://download.docker.com/linux/static/stable/x86_64/

2.解压

tar -xvf docker-18.06.1-ce.tgz

 

3.把解压出来的文件移动到/usr/bin 目录下

 

cp docker/* /usr/bin/

 

 

 

 4.将docker注册为service

vim /etc/systemd/system/docker.service

 

复制代码
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
 
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
 
[Install]
WantedBy=multi-user.target
复制代码

 

 5.启动

chmod +x /etc/systemd/system/docker.service
systemctl daemon-reload
systemctl start docker            
systemctl enable docker.service            
原文:https://blog.csdn.net/ywd1992/article/details/82897394 

 

 6.安装好的docker没有补全,从其他服务器拷贝一份docker

ll  /usr/share/bash-completion/completions/docker

 

 7.将docker文件放置相同路径下,并生效

source  /usr/share/bash-completion/completions/docker

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  

  

 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多