I have briefly summarized the basic formats used in Dockerfile.
Dockerfile is a text file for building Docker images with the docker build command.
| Format | Explanation |
|---|---|
| FROM <image> | Specify the Docker image that is the base of Docker image. It's a good idea to specify the minimum required so that the size does not become too large. Linux example:ubuntu:latest、alpine:latest |
| RUN <command> | Execute the command. Frequently used commands: apt-get update && apt-get install -y |
| CMD ["executable", "param1", "param2", ...] | Default command when running a container |
| Format | Explanation |
|---|---|
| COPY | When copying files and folders |
| ADD | When copying and decompressing a compressed tar file |
| ENTRYPOINT | Similar to CMD. It is used when the default command is not overwritten when executing with run. |
| ENV | Set environment variables |
| WORKDIR | Change the directory that executes the contents described in Dockerfile. When installing anaconda, not directly under root/opt/Install it on anaconda3. |
Dockerfile Reference (Japanese) Dockerfile reference (English)
Recommended Posts