본문 바로가기

카테고리 없음

docker (도커) engine 의 리눅스 설치법

Install using the repository

Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.

Set up the repository

  1. Update the apt package index and install packages to allow apt to use a repository over HTTPS:
  2. $ sudo apt-get update
    
    $ sudo apt-get install \
        ca-certificates \
        curl \
        gnupg \
        lsb-release
  3. Add Docker’s official GPG key:
  4. $ sudo mkdir -p /etc/apt/keyrings
    $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
  5. Use the following command to set up the repository:
  6. $ echo \
      "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
      $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    

Install Docker Engine

  1. Update the apt package index:Receiving a GPG error when running apt-get update?
    $ sudo chmod a+r /etc/apt/keyrings/docker.gpg
    $ sudo apt-get update
  2. Your default umask may be incorrectly configured, preventing detection of the repository public key file. Try granting read permission for the Docker public key file before updating the package index:
  3. $ sudo apt-get update
    
  4. Install Docker Engine, containerd, and Docker Compose.

    To install the latest version, run:

     $ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
    

  5. Verify that the Docker Engine installation is successful by running the hello-world image:This command downloads a test image and runs it in a container. When the container runs, it prints a confirmation message and exits.
  6. $ sudo docker run hello-world
    

You have now successfully installed and started Docker Engine. The docker user group exists but contains no users, which is why you’re required to use sudo to run Docker commands. Continue to Linux post-install to allow non-privileged users to run Docker commands and for other optional configuration steps.