Article Two: Docker simple introduction (ii)

Source: Internet
Author: User
Tags docker ps docker run

This article directory

    1. It's written in the front.
    2. The most common Docker commands
    3. Get Remote Warehouse Mirroring

It's written in the front.

  

As you can see this, later such articles please go to other platforms, because the blog park hints that the content is too simple, so after the simple content I will put on the csdn to learn and explore. "82593695"

Today and you share under Docker the most commonly used commands, too complex I do not know what is, but do not need to be afraid, because if you find some Docker command, you do not know, it is a good thing that you progress again. Of course today we will pull down the remote warehouse and see if our container can run. Previous Address "www.cnblogs.com/fourspace/p/9595514.html"

The most common commands

Docker images: Gets all the mirrors under the container, including the Mirror Warehouse source, mirror label, Mirror ID, create time, mirror size

  

"Docker ps-a": Get all containers, including display "Container ID", "Mirror Name", "Commond command", "Creation Time", "status"

  

"Docker start/stop Containerid": Start/Stop a known container

  

"Docker exec-it Containerid [command]": Into the daemon, meaning to go into the runtime environment, such as the MySQL environment, Docker exec-it 61fe60451bd1/bin/bash

  

Next, we will see root@61fe60451bd1:/#这样的目录, in fact, if we go through the container configuration, we can find some interesting things under a command, you can see, back to this command to

See what's inside of our MySQL, connect the next container to MySQL service,mysql-h 127.0.0.1-p 3306-u root-p123456

  

When you look at the big MySQL command, you are not very excited. The same as we normally use.

"Docker Inspect Containerid": View the container's internal configuration, or take MySQL as an example,

  

Discover an interesting thing, our container ID is actually an abbreviation, when we build the container, we create the container list under/var/lib/docker/containers/.

  

With the Docker file path, we can take advantage of some of the information inside.

  

I personally think that we need to be familiar with Docker-related, commonly used commands, these should suffice. There are, of course, Docker pull, Docker run, Docker build, and so on. will be introduced in the future, study not too anxious

  

Get Remote Warehouse Mirroring

Said so much, mirroring and containers. How to play?

I know there are two ways, the first is to use "Docker pull", the second is to build your own dockerfile, and then build it.

Today we have Nginx as an example, "Docker pull Nginx"

  

Well, very fast download, if there is a slow download, see the previous chapter, there is a way to configure the image acceleration. Okay, come back, let's see if the mirror is OK.

  

We see that Nginx is already in the mirror, very good. So, let's run a little bit now.

  

Mapping the local 8080 port to port 80, the Docker daemon gives a containerid, he is our container ID, we look at the container list, find this container, see the status is up.

Run around the local,

  

Here, met the familiar interface, we can pull the remote nginx image, it is very convenient to build our container, and then 666 of the run up, very convenient.

The above is my simple summary, suitable for quick start or want to know the next Docker friends, I hope you can enjoy.

This kind of article will be updated occasionally, if, please indicate the source.

E-mail: wuyun151@163.com Wuyunlong.

  

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.