Dokcer Container Management commands for learning notes

Source: Internet
Author: User
Tags docker stop container docker ps

Here is a simple note on the command that runs the container:

Docker run IMAGE [COMMAND] [ARG ....]


Run executes commands in a new container

-I--interactive=true|fasle default is false interactive mode

-T--tty=true|false default is False port

Eg:docker run-i-T Centos/bin/bash

Container view:
Docker Ps-a|-l

-a list of all containers

-L just ran a container

PS No parameter only lists the running


Docker inspect + container name to view the contents of the container

Custom container Name:

Docker run IMAGE--name= container name-i-t Centos/bin/bash

Restarting a container that has stopped

Docker start [-i] container name

To delete a stopped container

Docker RM Container Name


To start the daemon container:

1, can be long-term operation
2. No Interactive session
3. Suitable for running applications and services

One

1. Docker Run-i-T Image/bin/bash
2, CTRL +p CTRL +Q


Two

Docker run-d mirroring [COMMAND] [ARG ....]

To stop a daemon container:
Docker Stop container Name

Docker Kill container Name


To view the container log:

Docker logs [-f][-t][--tail] container name
-F--follows=true|false Default to False
-T--timestamps=true|false default to False
--tail= "All"

Production See container process
Docker Top Container Name


Start a new process within a running container:

Docker exec [-d][-i][-t] container name [Command][arg ...]


Container Port mappings:

Run [-p][-p]

Docker run-p-i-t Centos/bin/bash Map All ports

Docker run-p 80-i-T centos/bin/bash map single port


1, only specify the container port, host port random
Docker run-p 80-i-T Centos/bin/bash

2. Specify host-to-container port mappings
Docker run-p 8088:80-i-T Centos/bin/bash

3. Specify the host IP to the port of the container
Dokcer run-p 0.0.0.0:80-i-T Centos/bin/bash

4. Specify host IP and Port-to-container port mappings
Docker run-p 0.0.0.0:8088:80-i-T Centos/bin/bash

This article is from the "Vbird" blog, make sure to keep this source http://cpvbird.blog.51cto.com/3165113/1672063

Dokcer Container Management commands for learning notes

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.