View containers:

Docker ps [-a] [-l] View used container information

Docker inspect [name/ID] inspect container configuration information

Custom container name:

Docker run –name=[name] specifies the name of your container

Restart stopped containers:

       docker  start  -i  [ name ]

Delete stopped containers:

       docker  rm [ name ]

 

What is a daemon container?

Capable of long-term operation

No interactive session

Suitable for running applications and services

 

Run the container as a daemon:

docker run -i -t IMAGE  [command]

Ctrl + P & Ctrl + Q causes the container to run in the background (without exiting)

 

Start a daemon container:

docker  run  -d  [name]  [COMMAND][ARG….]

The -d argument runs the command in the background and stops the container after the command is finished

 

 

View container logs:

docker  logs [ -f ] [ -t ] [ –tail ]  [name]

– f – follows = true | false is false by default

– t – the timestamps = true | false is false by default

– tail = “all”

 

To view processes in a container:

docker top [name]

 

Start a new process in a running container:

docker exec [ -d ] [ -i ] [ -t ]  [name]  [COMMAND] [ARG….]

 

Stop daemon containers:

Docker stop [name] // Stop the container after the command is run

Docker kill [name] // Kill the container immediately