Install and run docker in linux, and run docker in linux

Source: Internet
Author: User
Tags docker hub

Install and run docker in linux, and run docker in linux

Writer environment:

1. lsb_release-

Hello @ hello :~ $ Lsb_release-
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial

2. Update apt and install the gpg key

2.1 sudo apt-get update

2.2 sudo apt-get install apt-transport-https ca-certificates

2.3 sudo apt-key adv -- keyserver hkp: // p80.pool.sks-keyservers.net: 80 -- recv-keys 58118E89F3A912897C070ADBF76221572C52609D

3. Edit the source file

Sudo vi/etc/apt/source. list. d/docker. list (this file can be created directly if it does not exist)

Delete all content in the file and write the content to the following directory:

Deb https://apt.dockerproject.org/repo ubuntu-xenial main

4. Update the apt package Index

Sudo apt-get update

5. Install docker

Sudo apt-get install docker-engine

6. Start docker

Sudo service docker start

7. Verify that docker is running

Sudo docker run hello-world

The writer running result is as follows:

Hello @ hello :~ $ Sudo docker run hello-world
Unable to find image 'hello-world: latest 'locally
Latest: Pulling from library/hello-world
B04784fba78d: Pull complete
Digest: sha256: sha256
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.
3. The Docker daemon created a new container from that image which runs
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:
$ Docker run-it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
Https://cloud.docker.com/

For more examples and ideas, visit:
Https://docs.docker.com/engine/userguide/

8. Add the current user to the docker Group

Sudo usermod-a-G docker hello

9. Restart docker

Sudo service docker restart

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.