Docker Redis Image

<< Docker-compose Docker Redis Performance >>

Docker Redis Image

Dockerfile

📄 Dockerfile
  • CMD: It will be specified at run time, so it was not used here.
  • EXPOSE: It will be specified at run time, and the ports to use will be set in the redis.conf file, so it was not used here.

Build a Redis image

💻 Terminal
  • The last period (.) is the location of the Dockerfile.

Run a Redis image

💻 Terminal

Connect with a shell

💻 Terminal

Connect with redis-cli

💻 Terminal


Dockerfile instructions

  • FROM: Specifies the base image.
    FROM image[:tag] [AS name]
  • 📄 Dockerfile
  • MAINTAINER: Provides contact information for the person who created the image.
    It can be replaced by Label.
    MAINTAINER name
  • 📄 Dockerfile
  • LABEL: Provides a label (description).
    LABEL key=value
  • 📄 Dockerfile
  • USER: Specifies the user. The default is root.
    USER root
  • ENV: Specifies environment variables. It helps avoid repetitive work and prevent errors.
  • 📄 Dockerfile
  • VOLUME: Specifies a volume. You can mount a host directory onto this volume.
  • 📄 Dockerfile

    The following are characteristics of volumes.
    • A volume is a directory separated from the container's root file system.
    • Volumes are managed directly by the Docker daemon and can be shared between containers.
    • A volume can be used when mounting a host directory into a container.
    • When a running container is updated into an image, the volume is not included in the update.
    • Because a volume is a file system separate from the container, it is not included in the layers that make up the image. Therefore, reading from or writing to a volume is done directly without going through layers.
    • If multiple containers use one volume, that volume is kept until all of those containers have stopped.
  • WORKDIR: Specifies the working directory. RUN and CMD instructions run in the working directory.
  • 📄 Dockerfile
  • ADD: Copies host files into the image.
  • 📄 Dockerfile
  • COPY: Copies host files into the image. It is more limited than ADD.
  • EXPOSE: Specifies the ports to use from outside the container.
    It is used for links between containers, and you must connect it to a host port with RUN -p host_port:container_port.
  • 📄 Dockerfile
  • RUN: Runs a command.
  • 📄 Dockerfile
  • CMD: A command that starts the process you want to run inside the container.
  • 📄 Dockerfile
  • ENTRYPOINT: Similar to CMD, but it is not overwritten by the RUN command.
    ENTRYPOINT file or sh arg1 arg2
  • 📄 Dockerfile
  • ONBUILD
  • STOPSIGNAL
  • HEALTHCHECK
  • 📄 Dockerfile
  • SHELL


<< Docker-compose Docker Redis Performance >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.