DOCKERDEX

Welcome! choose your starters and get started!

Windows Mac Linux

Commands

$ docker ps Looks at the current running Processes on Docker.
$ docker ps -a Looks at the ALL Processes on Docker.
$ docker version Looks at the version of Client/Server of Docker.
$ docker info Looks at the Detailed information of Docker status.
$ docker images Looks at the current Images that are on the Docker.
$ docker run hello-world Install hello-world image from docker daemon and run img.
$ docker rm [Container_ID] Remove Exited Image from docker.
$ docker rm -f [Container_ID] Forcefully Remove Image from docker.
$ docker start [Container_ID] Start the Existing Docker Img.
$ docker attach [Container_ID] Attach onto a currently running docker container.
$ docker cp [src] [contnr_name/id]:[dest] Copy src(folder or file) into destination in container.
$ docker rmi [Image_ID] Remove Image that is not in Container.
$ docker build [options] PATH | URL Build docker image based on Dockerfile at PATH|URL. Common option is -t to specify repository name of created image.
$ docker run -it ubuntu bash Install ubuntu:latest Image and run in Bash shell.
$ exit Exit out of running shell.

Dockerfile Instructions

Click an instruction link for more details.

FROM <image> Sets the image where instructions are to be ran. Must be at top of Dockerfile.
RUN <command> [flags] [param,...] Executes commands. Creates and commits new layer, so subsequent instructions work with newly committed image.
CMD <command> [flags] [param,...] Sets default command, which will be executed when the container is run without specifying a command. Only one will work per Dockerfile, last one used. If running with command specified, CMD will be overridden and ignored.
ENTRYPOINT <command> [flags] [param,...] Same as CMD, but will not be overridden when running with command specified.
ENV <key>=<value>,... Set environment variables for all subsequent instructions.
COPY <src>... <dest> Copies local files and directories to container at specified (absolute) location. Can use multiple sources, and can include wildcards.
ADD <src>... <dest> Same as COPY, but sources may be URL, and will unpack sources if compressed.
EXPOSE <port> [<port>...] Container will listen to specified ports at runtime. To make ports accessable to the host, use -p or -P to publish exposed ports.
WORKDIR /path/to/workdir Set working directory for all following RUN, CMD, ENTRYPOINT, COPY, ADD instructions. Creates directory if it doesn't exist. Can use previously set ENV variables, but only those set in Dockerfile.

Helpful Links

  • RUN vs CMD vs ENTRYPOINT
  • What is EC2 Container Service? (ECS)
  • [YouTube] AWS Webcast - Amazon EC2 Container Service Deep Dive
  • [YouTube] Basic Docker Tutorial (Low Quality but good Info)
  • [YouTube] Docker Tutorial: Building Docker Images Using Dockerfile
  • [YouTube] Docker Tutorial 6 - Dockerfiles (2 parts)
  • [YouTube] Building a Microservice using Node.js & Docker
  • [YouTube] Basic nginx Tutorial