Docker - Containers

Card Puncher Data Processing

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.

Properties

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)

root@c94698e7ab68:/#

You can get a container Id by name with:

docker container ls -qf name=containerName
10aca1bd6d00

Name

A container acquire a name:

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

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

Docker For Windows Switch Container Type

Version

The build version with inspect.

docker inspect -f '{{ index .Config.Labels "build_version" }}' <container_name>

Management

Create

Start

List

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:

docker info
Containers: 9                                                                                    
Running: 1                                                                                      
Paused: 0                                                                                       
Stopped: 8

==== 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

docker diff container_name

==== Restart ==== The docker restart command that runs a stop and then start on the container. ==== 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 ==== Configuration and status information (IP, …)==== Docker - Inspect ==== Process ==== Docker - Top (Process)





Discover More
Windows Search Path
Ansible - Windows Installation

Ansible is not certified on Windows and will never. The best solution that we found was to run Ansible inside a docker container. To install it: Clone the repository...
Card Puncher Data Processing
Aws - Elastic Container Service (Ecs)

Amazon Elastic Container Service (Amazon ECS) is a container orchestration service that supports Docker containers. A task in ECS is a set of container images that should be scheduled together....
Card Puncher Data Processing
Docker

is a lightweight virtualization platform. allows you to run Linux and windows applications (image inside containers). The project provides the means of packaging applications in lightweight containers...
Card Puncher Data Processing
Docker - (Virtual) Host (or Machine or Server) - Docker Type

This page is the host machine in Docker (ie the machine where the daemon is installed). Before a host was created through the docker-machine executable (creation, start, stop,...) but with the WSL...
Card Puncher Data Processing
Docker - /var/run/docker.sock (Communicating from container to the daemon)

/var/run/docker.sock is the socket where the docker daemon listens on by default and it can be used to communicate with the daemon from within a container. The H option permits to configure the...
Architecture
Docker - Architecture

The docker architecture is composed of: an host where the daemon run a daemon that manage and run all Docker object (such as image and container) a registry to download and push image a docker...
Card Puncher Data Processing
Docker - Bash Shell

To start a shell in a container: where:
Card Puncher Data Processing
Docker - CP command (COPY|ADD)

The copy command copies files/folders between a container and the local filesystem and vice-versa. From local system to container From container to local system
Card Puncher Data Processing
Docker - Commit (Image History)

Create a new image from a container's changes A RUN instruction in a build dockerfile generates commits. containers can then be created from any point in an image’s history, much like source control....
Card Puncher Data Processing
Docker - Create (a new container)

The docker create command creates a new container See



Share this page:
Follow us:
Task Runner