-
Notifications
You must be signed in to change notification settings - Fork 0
Docker
A Bhat edited this page Sep 30, 2020
·
7 revisions
- Most popular container software
- Service has both free and premium tiers
- Started in 2013 and is developed by Docker Inc
Use-case | Command |
---|---|
Build image | docker build - < Dockerfile |
Pull image | docker pull ... |
Run a command in a new container | docker run [OPTIONS] IMAGE [COMMAND] [ARG...] |
List images | docker images [OPTIONS] [REPOSITORY[:TAG]] |
List containers | docker container ls |
Remove all stopped containers | docker container prune [OPTIONS] |
Instruction | Description |
---|---|
ARG | Define variables |
FROM | Specify base image for building a new image |
LABEL | Add metadata to an image, such as description, version, author... |
RUN | Command to execute during build process Each RUN instruction creates a new layer on top of the current image |
ADD | Copy files and directories |
COPY | Similar to ADD, only a local file or directory |
ENV | Define an environment variable. |
CMD | Specify a command that will be executed when you run a container You can use only one CMD instruction in your Dockerfile |
ENTRYPOINT | Defines what command will be executed when running a container |
WORKDIR | Sets the current working directory for the RUN, CMD, ENTRYPOINT, COPY, and ADD instructions |
USER | Set the username or UID to use for the RUN, CMD, ENTRYPOINT, COPY, and ADD instructions |
VOLUME | Mount a host machine directory to the container |
EXPOSE | Specify the port on which the container listens at runtime |
- Software that hosts the containers
- Runtime instance of a docker image
- A text document that contains all the commands you would normally execute manually in order to build a Docker image.
- Basis of containers
- An ordered collection of root filesystem changes and the corresponding execution parameters for use within a container runtime.
- Typically contains a union of layered filesystems stacked on top of each other.
- Does not have state and it never changes.
- A modification to the image represented by an instruction in the Dockerfile
- A label applied to a Docker image in a repository.
- A set of Docker images
- The different images in the repository can be labeled using tags.
- A centralized resource for working with Docker and its components