Ubuntu18.04 installation Docker
I am using VMware virtual machine installed Ubuntu18.04, because a few days ago on the computer to do Xen virtualization ubuntu system accidentally broken, so this time to learn the following lessons, first play on the virtual machine.
-
Install The VMware VM. Install Ubuntu18.04. Step one search a lot of…
-
Sudo su into root mode, no need to add sudo to every command.
-
Sudo apt-get update sudo apt-get update sudo apt-get update
-
Sudo apt-get install -y docker. IO 下载 docker: sudo apt-get install -y docker
-
Sudo Docker -v If the following information is displayed, docker is successfully installed
-
Sudo systemctl start docker Starts the docker
-
Sudo systemctl enable Docker Enable docker during system boot
OK, so far Docker has been running on your system, now you need to use Docker to do something
sudo docker pull hello-world
Hello world!! Docker is no exception. Let’s first pull the simplest image and use the pull command
It doesn’t matter if it’s not like mine. I already did it once
sudo docker images
View existing mirrors on the local host
It doesn’t matter how many mirrors there are. Let’s just lookgreenHello world in color is ok, if it is green, it means you are successful!!
sudo docker run hello-world:latest
Run the image you pulled, and the Hello-world becomes the container. Oh, that’s strange. In fact, this step is to instantiate the image, similar to the C++ class and object relationship. If you’re not sure, check out this thread: dockone. IO /article/605…
If this screen appears, you are done!! Ps: run has a lot of configurable parameters, this post does not explain, interested can be in-depth study
Here are a few more common Docker commands to look at
docker start container_name/container_id // Start the Docker container
docker stop container_name/container_id // Stop the docker container
docker restart container_name/container_id // Restart the docker container
docker kill container_name/container_id // Kill a running container
docker attach container_name/container_id // After starting a container in the background, enter the container
docker rm container_name/container_id // Delete the container
docker pause // Suspend all processes in the container
docker unpause // Restore all processes in the container
docker exec // Execute a command in a running container to exit the host without closing the container
docker cp // Used to copy data between containers and hosts
docker diff // Check for changes to the file structure in the container
docker import // Create an image from the archive
docker save // Save the specified image as a tar archive
docker load // Import the image exported using the docker save command
exit // Exit the container directly and return to the host
docker container prune// Clean up all terminated containers
Copy the code
After this post, the next post will talk about native applications distributed via Docker