Docker implemented by virtual container technology

Docker

Virtual containerization technology is not docker, it is not equal to docker. Docker is only the embodiment of virtual containerization technology, which is closer to us.

Introduction to Dockers

Docker is a cloud open source project implemented by DaoCloud based on the Go language

Main purpose: Build, ship, and Run Any App, Anywhere

The main architecture is: image (images), container (container), warehouse (repository)

Installation and basic configuration

Please refer to the Linux section for configuration details. The configuration is the same except that the installation method is slightly different.

Windows:

Win10 64建议Docker for Windows:https://docs.docker.com/docker-for-windows/install

Dockers Toolbox is recommended for other versions of Windows: https://docs.docker.com/toolbox/toolbox_install_windows

After the download is complete, click to install, so I won’t repeat it here.

docker -v # 查看自己版本,显示版本号即证明安装成功
docker run hello-world # 正常运行无报错即可证明完成成功

Mac:

docker for mac (recommended): version 10.11 and above, at least 4GB RAM.

Based on Homebrew:

brew cack install docker

Installation package: https://download.docker.com/mac/stable/Docker.dmg

You can also install Docker Toolbox if you do not meet the requirements: https://docs.docker.com/toolbox/overview

Linux:

Docker installed based on centos7

  1. First, you need to confirm the version of centos:
cat /ect/redhat-release

Insert picture description here

  1. Install gcc and related
  yum -y install gcc
  yum -y install gcc-c++
  gcc -v //确认完成安装(查看gcc的版本)
  1. Uninstall the old version of docker and docker-engine (if not installed, this step can be ignored)
  sudo yum remove docker \
                    docker-client \
                    docker-client-latest \
                    docker-common \
                    docker-latest \
                    docker-latest-logrotate \
                    docker-logrotate \
                    docker-engine
  1. Set up stable mirror warehouse

Install the yum-utilssoftware package (provide yum-config-managerutilities) and set up a stable repository.

sudo yum install -y yum-utils
sudo yum-config-manager \
    --add-repo \
    https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    (推荐)
    (https://download.docker.com/linux/centos/docker-ce.repo)[不推荐,此命令是直接去国外的docker官网上下载,速度慢、且不稳定]
  1. Update yum package index
sudo yum makecache fast
  1. Install Docker CE
yum -y install docker-ce
  • Check docker (or check version)

Insert picture description here

  1. Start docker
systemctl start docker
  1. Test docker
docker version //查看docker版本
docker run hello-world //如下

Insert picture description here

  1. Configure mirror acceleration
1.mkdir -p /etc/docker(可以先查看是否有这个目录,如果没有则需要创建,否不需要!)
2.vim /etc/docker/daemon.json
// 配置信息(将以下信息中其中之一配入daemon.json中)
a.网易云:
{
    
    "registry-mirrors":["http://hub-mirror.c.163.com"]}
b.阿里云:
{
    
    "registry-mirrors":["https://{自己账号编码}.mirror.ailiyuncs.com"]}
3.systemctl daemon-reload
4.systemctl restart docker
5.ps -ef|grep docker // 检测加速器是否生效
  1. Uninstall
systemctl stop docker //停止docker
yum -y remove docker-ce //移除docker
rm -rf /var/lib/docker //移除docker

Port forwarding:

临时修改:

# echo 1 >/proc/sys/net/ipv4/ip_forward
 //停止docker
yum -y remove docker-ce //移除docker
rm -rf /var/lib/docker //移除docker

Port forwarding:

临时修改:

# echo 1 >/proc/sys/net/ipv4/ip_forward

If you have any questions, please leave a message in the comment area for
more articles, contact bloggers, technical exchanges, and business cooperation.
Personal email: [email protected]
github: https://github.com/Payne-Wu
Scan the code or search the official account : Product Coder
Insert picture description here

Guess you like

Origin blog.csdn.net/wzp7081/article/details/108781707