[DOCKER] Centos7 Docker설치하기

Posted by Albert 784Day 19Hour 13Min 2Sec ago [2023-02-25]

오늘도 무료한 하루 

docker로 장난감 많이 다뤄볼려고 설치하기로 하였다. 설치절차는 아래와 같음


1. 시스템 yum 최신상태로 업데이트 및 종속성 추가

[albert@docker ~]$ sudo yum update
[albert@docker ~]$ sudo yum install yum-utils device-mapper-persistent-data lvm2

 

2. docker repo 추가

[albert@docker ~]$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror, langpacks
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo


3. docker-ce 설치

[albert@docker ~]$ sudo yum install docker-ce


4 docker 데몬 시작 및 부팅 시 docker 데몬이 자동으로 시작되도록 설정

[albert@docker ~]$ sudo systemctl start docker
[albert@docker ~]$ sudo systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[albert@docker ~]$ sudo systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since 2023-02-25 16:32:54 KST; 22s ago
Docs: https://docs.docker.com
Main PID: 3325 (dockerd)
CGroup: /system.slice/docker.service
└─3325 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/cont...


5. 일반계정 사용시 sudo 없이 사용할 수 있게 docker 그룹 추

[albert@docker ~]$ sudo usermod -aG docker $USER
[albert@docker ~]$ su albert
암호:
[albert@docker ~]$ docker container 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/


sudo usermod -aG docker $USER 명령어로 사용하면 docker 그룹에 추가된다.

하지만 바로적용되지않고 로그아웃햇다가 다시 접속해야 되므로 su 계정 으로 로그인하여 

정상적으로 출력되는걸 볼 수 있다.





LIST

Copyright © 2014 visionboy.me All Right Reserved.