Docker

docker, docker-compose 설치 on Ubuntu

thxxyj 2022. 12. 19. 17:15
728x90

1. docker 설치하기

https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository

 

1. 패키지 설치

sudo apt-get update
sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

 

2. GPG key 추가

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

 

3. repository 셋업

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

 

4. 도커 엔진 설치 (CE(Community Edition)의 latest 버전의 도커 엔진과 컨테이너 데몬 서비스를 설치)

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

 

 

** get-docker.sh로 간단하게 도커 설치하는 법 **

https://get.docker.com/

sudo apt update
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

 

2. docker-compose (standalone) 설치하기

https://docs.docker.com/compose/install/other/

## 2022-12 ver

curl -SL "https://github.com/docker/compose/releases/download/v2.14.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

 

 

* docker compose plugin 과 docker compose standalone 차이점

https://stackoverflow.com/questions/66514436/difference-between-docker-compose-and-docker-compose

 

 

* sudo 없이 docker command 사용하기

그냥 docker command를 사용했을 때 다음과 같은 에러가 발생한 경우 해당 사용자를 docker group에 추가한다.

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json": dial unix /var/run/docker.sock: connect: permission denied

user1@server:~$ sudo usermod -aG docker $USER
user1@server:~$ cat /etc/group | grep docker
docker:x:136:user1

 

* docker, docker-compose 설치 후 Permission denied 발생하는 경우 해결 방법

 

docker, docker-compose 설치 후 Permission denied

docker, docker-compose 설치 방법은 아래 글 참고 docker, docker-compose 설치 on Ubuntu 1. docker 설치하기 https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository 1. 패키지 설치 sudo apt-get update sudo apt-get instal

thxxyj.tistory.com

728x90