Docker – Overview

1. How does Docker work?
1.1 Build Docker Images that hold your applications.
1.2 Create Docker Containers from those Docker Images to run your applications.
1.3 Share Docker images via Docker Hub or your own registry.

 

2.Docker container lifecycle

– Conception
Build an image from a dockerfile
– Birth
Run (create + start) a container
– Reproduction
Run a new container from an image
– Sleep
Kill a running container
– Wake
Start a stopped container
– Death
RM (delete) a stopped container
-Exitinction
RMI (delete) a container image

 

3.Docker Commands (Used in Dockerfile)

Attention: all relative paths are relative to the Dockerfile

FROM    Specifies a source image for our new image that we plan to build. (mandatory)

MAINTAINER    Tells us who built/maintains the image.

RUN   Executes a command.

CMD   Default command to run when a container is launched.

EXPOSE   Lists the network ports to open when a container is launched from this image.

ADD   Adds files and contents from host into the image.

Adds files as owned by ‘root’ with permissions 0755.

COPY   Copies the files.

The source directory must be inside the context of build (one of directories/sub-directories of the current directory where Dockerfile is located).

VOLUME   Creates a data volume mount point at the specified path.

Data volumes can be shared and reused between containers.

Data volumes persist until all containers referencing them are destroyed.

ENV   Specifies environment variables that should be set in any container launched from the image.

ENTRYPOINT   The first command/script that gets executed.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s