Docker 설치
1.OS확인
2.계정생성
Docker 설치 전 Docker 전용 user생성과 sudo권한 부여
2.1 useradd docker
useradd docker
passwd docker
su docker
2.2 visudo
su root
visudo
#
102 docker ALL=(ALL) NOPASSWD:ALL #추가
#
su docker
2.3 저장소 설정
sudo yum install -y yum-utils
repo 추가?
3. install docker
[docker@seanxx ~]$ sudo yum install docker-ce docker-ce-cli containerd.io
3.1 도커 실행
sudo systemctl start docker
sudo systemctl status docker
sudo docker version
3.2 도커 hello-world
sudo docker run hello-world 로 테스트
#다른 계정으로 테스트
sean$ sudo docker run hello-world
3.3 Docker 계정 추가
usermod -a -G docker [user]
기존 root나 docker을 설치했던 docker 계정이 아닌 일반 계정으로 접속 후 docker run hello-world 실행
permission denied.되었다.
#계정추가
[docker@seanxx ~]$ sudo usermod -a -G docker sean
#sean계정으로 docker run hello-world 출력
[sean@seanxx docker]$ docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
[sean@seanxx docker]$