From the course: Introduction to Docker for Java Developers

Unlock the full course today

Join today to access over 24,600 courses taught by industry experts.

Writing Dockerfiles

Writing Dockerfiles

- Now let's learn how to build an image. The primary tools for standing up a Docker image is with a Dockerfile and the Docker build command. Let's learn about Dockerfiles first. A Dockerfile is basically an image recipe card. It begins with a From base image and ends with a CMD or entrypoint command. From provides the builder a starting state, followed by more of the following, add and copy commands contribute files from the local file system into the image. Additional Froms are for creating multi-stage builds. Run executes a shell command within the image. User claims a user permissions for proceeding instructions. Volume is used to associate a folder in a container with external data. Workdir changes the current working directory. And CMD or entrypoint is the final command which usually launches the containerized application. There's a lot more instructions that are available, but these are just some of the basic ones…

Contents