Docker - Containers

1 - About

VM - Container (Ligthweight VM) in Docker.

A container is a running instance of an image.

Docker containers only run as long as the command you specify is active.

3 - Properties

3.1 - Id

A container ID uniquely identifies a container.

A container ID has two versions:

  • a long variant: 3e3a1ac2c76e447542b99de6db704629e414a674301c520687a7dc13a841746d
  • a shorter variant: 3e3a1ac2c76e
By running bash on the Ubuntu Image,

$ docker run -t -i ubuntu bash

You can see the container id in the prompt (here: c94698e7ab68)


[email protected]:/#

You can get a container Id by name with:


docker container ls -qf name=containerName


10aca1bd6d00

3.2 - Name

A container acquire a name:

  • via the -name parameter of the run command.
  • or automatically if not given (ie generated)

3.3 - Type

The daemon cannot run the two type of container. Therefore you need to switch the daemon by switching the type of containers. Example with docker for windows

4 - Management

4.1 - Create

  • Docker - Create (a new container)
  • docker run Create a new container with a start command

4.2 - Start

  • docker run Create a new container with a start command
  • docker start Start one or more stopped containers

4.3 - List

4.3.1 - Running

The docker ps']]' command queries the Docker daemon for information about all the containers it knows about. See Docker - ps (List containers) === All === Docker - info gives also information: <code dos> docker info </code> <file> Containers: 9 Running: 1 Paused: 0 Stopped: 8 </file> ==== Logs ==== See Docker - logs of a container ==== Stop ==== Docker - Stop (a container) ==== Kill ==== docker kill - Kill one or more running containers ==== Diff ==== A list of files created or modified sinds a docker run. Inspect changes on a container's filesystem <code bash> docker diff container_name </code> ==== Restart ==== The docker restart'' command that runs a stop and then start on the container.

4.4 - Remove


docker rm [OPTIONS] CONTAINER [CONTAINER...]

Remove one or more containers

Options:

  • -f, –force Force the removal of a running container (uses SIGKILL)
  • –help Print usage
  • -l, –link Remove the specified link
  • -v, –volumes Remove the volumes associated with the container

4.5 - Configuration and status information (IP, ...)

Docker - Inspect

4.6 - Process

Docker - Top (Process)


Data Science
Data Analysis
Statistics
Data Science
Linear Algebra Mathematics
Trigonometry

Powered by ComboStrap