DEV Community

Ibrahim S
Ibrahim S

Posted on

Docker Commands - Basic

  1. FROM: Specifies the base image for subsequent instructions.
  2. COPY: Copies files or directories from the host into the container.
  3. RUN: Executes commands in the container during image build.
  4. CMD: Defines the default command to run when the container starts.
  5. EXPOSE: Exposes ports for networking between the container and host.
  6. ENV: Sets environment variables in the container.
  7. WORKDIR: Sets the working directory for subsequent instructions.
  8. VOLUME: Creates a mount point and makes it accessible from the container.
  9. ENTRYPOINT: Specifies the command to run when the container starts, overriding CMD.
  10. ARG: Defines build-time arguments for Docker builds.
  11. LABEL: Adds metadata to an image.
  12. USER: Sets the user or UID to run container processes.

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay