< >
Home » 树莓派服务器 » 树莓派服务器-搭建Docker

树莓派服务器-搭建Docker

树莓派服务器-搭建Docker

说明:

  • 介绍如何安装Docker
  • 环境:ubuntu mate 20.04

步骤:

  • 脚本安装
$ curl -fsSL get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh --mirror Aliyun
  • 启动
$ sudo systemctl enable docker
$ sudo systemctl start docker
  • 安全使用,建立 docker 用户组
$ sudo groupadd docker
$ sudo usermod -aG docker $USER
  • 测试 Docker
$ docker run --rm hello-world

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
4ee5c797bcd7: Pull complete
Digest: sha256:308866a43596e83578c7dfa15e27a73011bdd402185a84c5cd7f32a88b501a24
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.
    (arm32v7)
 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源比较慢,更改源进行加速
touch /etc/docker/daemon.json
  • 内容如下:
{
  "registry-mirrors": [
    "https://hub-mirror.c.163.com",
    "https://mirror.baidubce.com"
  ]
}
  • 重新启动
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: 树莓派服务器