Docker学习与实践

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Docker学习与实践相关的知识,希望对你有一定的参考价值。

一、docker的安装

1.依赖包安装

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

2.添加yum源

yum-config-manager --add-repo https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
yum-config-manager --enable docker-ce-edge
#配置为安装最新版Docker CE

3.安装docker

yum install docker-ce

*官方为了简化安装流程提供了便捷的安装脚本

curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh --mirror Aliyun

4.启动docker

systemctl enable docker
systemctl start docker

5.建立docker用户和组
6.测试docker是否安装完成

[[email protected] ~]$ docker run hello-world
Unable to find image ‘hello-world:latest‘ locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pull complete 
Digest: sha256:083de497cff944f969d8499ab94f07134c50bcf5e6b9559b27182d3fa80ce3f7
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://cloud.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

7.配置镜像加速器并重启服务

cat /etc/docker/daemon.json 
{
"registry-mirrors": [
"https://registry.docker-cn.com"
 ]
}
systemctl daemon-reload
sudo systemctl restart docker

#学习文档地址:https://github.com/yeasy/docker_practice/blob/master/SUMMARY.md

以上是关于Docker学习与实践的主要内容,如果未能解决你的问题,请参考以下文章

docker学习与实践

Docker学习总结——云端基于Docker的微服务与持续交付实践

Docker学习与实践

Docker学习与实践

docker学习2-安装实践

逆向及Bof基础实践