zl程序教程

您现在的位置是:首页 >  工具

当前栏目

Ubuntu 16.04.7 LTS在线安装docker

Docker安装Ubuntu 在线 16.04 LTS
2023-09-14 09:16:02 时间

使用官方安装脚本自动安装

安装命令如下:

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
提示:
root@lykj-Standard-PC-i440FX-PIIX-1996:~# curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
程序“curl”尚未安装。 您可以使用以下命令安装:
apt install curl

安装curl然后在安装docker

查看docker服务是否启动:

$ systemctl status docker

若未启动,则启动docker服务:

$ sudo systemctl start docker

测试 Docker 是否安装成功
打印出以下信息则安装成功:

$ sudo docker run hello-world

root@lykj-Standard-PC-i440FX-PIIX-1996:~# sudo docker run hello-world
Unable to find image ‘hello-world:latest’ locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:df5f5184104426b65967e016ff2ac0bfcd44ad7899ca3bbcf8e44e4461491a9e
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/

查看当前版本
root@lykj-Standard-PC-i440FX-PIIX-1996:~# docker -v
Docker version 20.10.7, build f0df350

本示例使用 get.docker.com 上的脚本在ubuntu 上安装最新版本的Docker Engine-Community。要安装最新的测试版本,请改用 test.docker.com。在下面的每个命令,取代每次出现 get 用 test。

$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh

如果要使用 Docker 作为非 root 用户,则应考虑使用类似以下方式将用户添加到 docker 组:

$ sudo usermod -aG docker your-user