docker 门外初体验--docker 安装(一)

本文是一篇关于Docker的入门教程,详细介绍了如何在Ubuntu上安装Docker,包括更新apt包、添加官方GPG密钥、设置仓库和安装Docker引擎。最后通过运行'hello-world'容器验证了Docker的安装。文章还提到了作者使用Docker搭建的各种服务,如Git仓库、在线文档工具、博客网站和开发环境。
摘要由CSDN通过智能技术生成

系列文章目录

docker 门外初体验–docker 安装(一)



前言

重写对docker的学习记录,最主要的原因之一,花了大量的时间进行学习,形成一个从0至1的认识,但是工作中却没见有实际应用,导致所学的知识存活率很低,也为了丰富自身的技术体系


一、docker是什么?

Docker 是一个开源的应用容器引擎。学有所用,分享一下近几年来,基于docker技术,本人用它来做什么?

 基于Gitlab 搭建git仓库服务
 基于ShowDoc搭建在线文档工具
 基于WorldPress搭建博客网站
 搭建学习开发环境,如微服务mirco-services

学习新东西,先有概念,再有体验 ,深入学习,实践应用,总结优化。外国人常说的入门之旅,就是本人要说的体验。

二、安装

参考链接:https://docs.docker.com/engine/install/ubuntu/

更新apt包

$ sudo apt-get update

安装 apt 依赖包

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

添加 官方 GPG 密钥

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo apt-key fingerprint 0EBFCD88

设置稳定版仓库

$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

再次更新apt包并安装最新的docker引擎

 $ sudo apt-get update
 $ sudo apt-get install docker-ce 

如何安装特定的docker版本,先查询支持哪些dockert版本

$ apt-cache madison docker-ce

安装指定的docker版本

$ sudo apt-get install docker-ce=18.03.0~ce-0~ubuntu

三、验证

如下示例:docker run hello-world

root@iZuf6anc2b2vgfvms9d7elZ:~# sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete 
Digest: sha256:31b9c7d48790f0d8c50ab433d9c3b7e17666d6993084c002c2ff1ca09b96391d
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://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

四、总结

本文仅仅简单介绍了docker安装与验证,及本人的实际应用样例。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

嵌入式实操

希望博文有助于您,您不必加班。

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

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

打赏作者

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

抵扣说明:

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

余额充值