docker虚拟化容器技术

1、安装

#安装方式一 
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

#安装方法二
sudo apt remove docker docker-engine docker.io containerd runc
sudo apt update
sudo apt install apt-transport-https ca-certificates curl gnupg lsb-release
sudo apt install docker-ce docker-ce-cli containerd.io

sudo snap install docker     # version 20.10.8, or
sudo apt  install docker.io  # version 20.10.7-0ubuntu1~20.04.2

在这里插入图片描述

2、查看docker服务

$ docker --version
$ docker version
$ sudo systemctl status docker
$ sudo service docker status restart stop enable disable 

在这里插入图片描述

3、卸载

sudo apt remove docker docker-engine docker.io containerd runc
sudo apt autoremove docker-ce-*
sudo rm -rf /etc/systemd/system/docker.service.d
sudo rm -rf /var/lib/docker

或者

sudo systemctl disable docker
/lib/systemd/systemd-sysv-install disable docker
sudo find / -name docker.service | xargs sudo rm -rf
sudo find / -name docker.service
sudo rm /etc/init.d/docker
sudo systemctl daemon-reload
 sudo service docker status

或者

webrx@us:/etc/init.d$ sudo systemctl daemon-reload
webrx@us:/etc/init.d$ sudo rm /etc/init.d/docker
webrx@us:/etc/init.d$ sudo systemctl daemon-reload
webrx@us:/etc/init.d$ sudo systemctl status docker
Unit docker.service could not be found.
webrx@us:/etc/init.d$ sudo service docker status
Unit docker.service could not be found.
webrx@us:/etc/init.d$ 

4、帮助命令

$ docker version
$ docker --version
$ info
$ docker 命令 --help
$ docker pull --help
$ docker 回车查看所有命令信息

5、镜像命令

#1 查看本地镜像,没有镜像
webrx@us:~$ docker images
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE

#2 从官方hub.docker.com接取一个hello-world镜像案例
webrx@us:~$ docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
2db29710123e: Pull complete 
Digest: sha256:37a0b92b08d4919615c3ee023f7ddb068d12b8387475d64c622ac30f45c29c51
Status: Downloaded newer image for hello-world:latest
docker.io/library/hello-world:latest

#3 再查看镜像
docker images
docker images -q
docker images -aq

webrx@us:~$ docker images
REPOSITORY    TAG       IMAGE ID       CREATED       SIZE
hello-world   latest    feb5d9fea6a5   4 weeks ago   13.3kB

#4 运行hello-world镜像
webrx@us:~$ docker run hello-world

#运行结果
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/

#5 搜索镜像
docker search mysql
docker search webrx
 docker search --limit 35 --no-trunc centos
 docker pull mysql 拉取
     NAME: 镜像仓库源的名称
     DESCRIPTION: 镜像的描述
     OFFICAL: 是否docker官方发布
     stars: 类似Github里面的star,表示点赞、喜欢的意思
     AUTOMATED: 自动构建

#6 删除镜像
docker rmi -f 镜像ID	

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值