Installation deployment and simple application of Ubuntu Docker

  • 2020-05-17 07:14:03
  • OfStack

Docker literally means longshoreman. When it became a technology, it did what the longshoremen did. The website describes it this way: "Docker is a development platform for building, publishing, and running distributed applications for developers and system administrators." In other words, if you compare your application to goods, the dockers (Docker) will quickly load them in containers. Fast, simple and efficient.

It is written in the Go language and is the "container" (Linux containers) in which the program runs, enabling application-level isolation (sandbox). Multiple containers run with complementary effects, safe and stable.

What I like about it is that it deploys quickly, runs safely, and doesn't contaminate my system.

Deployment practice of Docker in Ubuntu

This article describes the deployment of Docker on Ubuntu systems. Among them, Ubuntu is 12.04.5 LTS and Precise Pangolin.

1. Install Docker


# apt-get update
# apt-get install docker.io
Reading package lists... Done
Building dependency tree    
Reading state information... Done
E: Unable to locate package docker.io
E: Couldn't find any package by regex 'docker.io'

Note that Docker software is not available in Ubuntu 12.04's software warehouse. Searching for information on the web, Ubuntu 14.04 supports Docker. Without upgrading OS, the installation requires a different approach.

It's just as well that Docker in the repository is usually not the latest version, and the latest version of Docker can be installed using other installation methods.
Note: in Ubuntu's repository, Docker is called docker. io because other software has already taken up the name Docker.


# curl -sSL https://get.docker.com/ubuntu/ | sudo sh
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.JO0wslsx8U --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
gpg: requesting key A88D21E9 from hkp server p80.pool.sks-keyservers.net
gpg: key A88D21E9: public key "Docker Release Tool (releasedocker) <docker@dotcloud.com>" imported
......
Setting up aufs-tools (1:3.0+20111101-1ubuntu1) ...
Setting up cgroup-lite (1.1.5) ...
cgroup-lite start/running
Setting up lxc-docker-1.7.1 (1.7.1) ...
docker start/running, process 10483
Setting up lxc-docker (1.7.1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

This command will replace Ubuntu's corresponding repository with the latest version of the Docker official repository. One thing to note is that if you install Docker this way, the package name for Docker should be lxc-docker. At this point, the name of the Docker command is still docker. In the previous setup, the name of the Docker command would be docker.io.

2. Upgrade Docker

# sudo apt-get update && sudo apt-get upgrade

3. Add user permissions

If it is not an root user operation, you can add a user to the Docker user group so that you do not need to use the sudo command to operate Docker. You can do this:

# sudo gpasswd -a USER docker

4. Check the installation of Docker


# docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d
OS/Arch (server): linux/amd64

5. List containers that are running


# docker ps
CONTAINER ID    IMAGE        COMMAND       CREATED       STATUS       PORTS        NAMES


6. List all containers (including running containers and exited containers)

# docker ps -a

7. Lists local (downloaded and locally created) images

# docker images

8. Run a new instance container from the mirror

# docker run

9. Stop one container

# docker stop

Thank you for reading, I hope to help you, thank you for your support of this site!


Related articles: