What is a Docker
The description on the website reads as follows:
Docker is the world’s leading software container platform.
Docker is an open source engine that makes it easy to create a lightweight, portable, self-contained container for any application. Containers that developers compile and test on laptops can be deployed in a production environment, including VMs (virtual machines), Bare Metal, OpenStack clusters, and other basic application platforms.
What problem was solved
- Developers use Docker to eliminate “works on my machine” problems when collaboratingon code with co-workers.
- Operators use Docker to run and manage apps side-by-side in isolated containers to get better compute density.
- Enterprises use Docker to build agile software delivery pipelines to ship new features faster, more securely and with confidence for both Linux, Windows Server, and Linux-on-mainframe apps.
Application scenarios
- Automated packaging and distribution of Web applications
- Automated testing and continuous integration, release
- Deploy and adjust databases or other backend applications in a service environment;
- Build from scratch or extend existing OpenShift or Cloud Foundry platforms to build your own PaaS environment.
start
The installation
Enter the official website: select the corresponding version
The installation steps are written in detail for each system, so I won’t repeat them here! After the installation is successful, enter Docker Version on the terminal to check whether the installation is successful
I got an error when installing on a Linux machine:
Got permission denied whiletrying to connect to the Docker daemon socket at Unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.26/images/json: dial Unix/var/run/docker. The sock: connect: permission deniedCopy the code
Solution: Add the current user to the Docker group.
$sudo gpasswd -a ${USER} docker
Copy the code
Is the IP address added successfully?
$ cat /etc/group | grep ^docker
Copy the code
Restart the Docker service
$ sudo service docker restart
Copy the code
Finally, if it does not work, please restart or log out of the user and log in again!
Into the Docker
Build Ship Run three keywords Docker image: a series of files; Docker container: Docker repository: netease Honeycomb Image official image
The first container
1. Download the Jpress war package and put it in the work directory: work 2. Run the following command to pull the Tomcat image and view the image after the drawing is complete
$docker pull hub.c.163.com/library/tomcat:latest / / pull mirror... . $docker images // View imagesCopy the code
The default tomcat image configuration is as follows:
$ sudo vim Dockerfile
Copy the code
Add the following content: the FROM hub.c.163.com/library/tomcat:latest MAINTAINER cuteximi [email protected] COPY jpress. War/usr/local/webapps
$docker build. -t jpress:lastest // there is a pointCopy the code
Run the first container
1. View the image: Docker Images found that the image we made already exists.
$ docker run -d -p 8888:8080 jpress:lastest
Copy the code
The orders of the docker
Click to see a complete set of commands
Recommended study sites
- website
- Chinese Docker community
- CSDN’s Docker knowledge base