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