Ubuntu14.04下安装docker

梦里梦外; 2022-07-14 04:08 384阅读 0赞

前言:

docker官网有很详细的安装教程,建议按照官网的步骤进行安装。

Install Docker on Ubuntu:https://docs.docker.com/engine/installation/linux/ubuntulinux/

docker需要3.10或者更高版本的内核支持,通过uname -r查看内核版本。

步一:更新apt源

  1. $ sudo apt-get update
  2. $ sudo apt-get install apt-transport-https ca-certificates

步二:添加新的GPG密钥

  1. $ sudo apt-key adv \
  2. --keyserver hkp://ha.pool.sks-keyservers.net:80 \
  3. --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

步三:通过lsb_release -a命令查看系统的版本,Ubuntu14.04

  1. Trusty 14.04 (LTS) deb https://apt.dockerproject.org/repo ubuntu-trusty main

步四:设置源

  1. $ echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list

步五:更新APT

  1. $ sudo apt-get update

步六:确认APT已经更新,正常会输出结果

  1. $ apt-cache policy docker-engine
  2. docker-engine:
  3. Installed: 1.12.2-0~trusty
  4. Candidate: 1.12.2-0~trusty
  5. Version table:
  6. *** 1.12.2-0~trusty 0
  7. 500 https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages
  8. 100 /var/lib/dpkg/status
  9. 1.12.1-0~trusty 0
  10. 500 https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages
  11. 1.12.0-0~trusty 0
  12. 500 https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages

步七:再次更新源

  1. $ sudo apt-get update

步八:安装增强包

  1. $ sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual

步九:再次更新源

  1. $ sudo apt-get update

步十:安装Docker

  1. $ sudo apt-get install docker-engine

步十一:启动Docker守护进程

  1. $ sudo service docker start

步十二:确认安装成功,这个命令会下载一个测试镜像。

  1. $ sudo docker run hello-world

看到这个界面意味着成功了:

  1. $ docker run hello-world
  2. Unable to find image 'hello-world:latest' locally
  3. latest: Pulling from library/hello-world
  4. 535020c3e8ad: Pull complete
  5. af340544ed62: Pull complete
  6. Digest: sha256:a68868bfe696c00866942e8f5ca39e3e31b79c1e50feaee4ce5e28df2f051d5c
  7. Status: Downloaded newer image for hello-world:latest
  8. Hello from Docker.
  9. This message shows that your installation appears to be working correctly.
  10. To generate this message, Docker took the following steps:
  11. 1. The Docker Engine CLI client contacted the Docker Engine daemon.
  12. 2. The Docker Engine daemon pulled the "hello-world" image from the Docker Hub.
  13. 3. The Docker Engine daemon created a new container from that image which runs the
  14. executable that produces the output you are currently reading.
  15. 4. The Docker Engine daemon streamed that output to the Docker Engine CLI client, which sent it
  16. to your terminal.
  17. To try something more ambitious, you can run an Ubuntu container with:
  18. $ docker run -it ubuntu bash
  19. Share images, automate workflows, and more with a free Docker Hub account:
  20. https://hub.docker.com
  21. For more examples and ideas, visit:
  22. https://docs.docker.com/userguide/

步十三:查看所有的容器

  1. $ docker ps -a

原文出自:http://blog.csdn.net/daiyudong2020/article/details/53353064

End;

发表评论

表情:
评论列表 (有 0 条评论,384人围观)

还没有评论,来说两句吧...

相关阅读