docker

김효준·2023년 12월 18일
0

centOs 7.8 root기준 도커 설치

https://docs.docker.com/engine/install/centos/#install-docker-engine-on-centos

yum remove docker \
    docker-client \
    docker-client-latest \
    docker-common \
    docker-latest \
    docker-latest-logrotate \
    docker-logrotate \
    docker-engine

# Set up the repository
# Install the yum-utils package (which provides the yum-config-manager utility) and set up the repository.
yum install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Start Docker.
systemctl start docker

# Verify that the Docker Engine installation is successful by running the hello-world image.
docker run hello-world

도커가 잘 돌아가고 있는지 확인하는 방법
systemctl status docker

도커를 정지하는 방법
systemctl stop docker
도커를 시작하는 방법
systemctl start docker
도커를 재시작 방법
systemctl restart docker
재부팅 시에 자동으로 도커가 실행되도록
systemctl enable docker
만약에 재부팅시에 자동으로 실행되지 않게 하려면
systemctl disable docker

server-3 이라는 ncp 내의 가상서버에서 돌고있는 경량 os(컨테이너) = 도커 의 현재 실행된 리스트

실습하다 망하거나 이상하면 도커 초기화 명령어 순서대로 칠것

컨테이너 삭제
docker rm -f $(docker ps -qa)

이미지 삭제
docker rmi -f $(docker images -qa)

안쓰는 네트워크 삭제
docker network prune -f

안쓰는 볼륨 삭제
docker volume prune -f

도커 프로젝트 삭제
rm -rf /docker_projects

이미지는 프로그램, 컨테이너는 프로세스

도커 이미지
프로그램으로 비유 : 설치된 프로그램(1개)
클래스와 객체로 비유 : 클래스(1개)
OS로 비유 : OS 설치 CD(OR OS 설치 USB 메모리)

도커 컨테이너
프로그램으로 비유 : 실행중인 프로그램(프로세스)(N개)
클래스와 객체로 비유 : 객체(N개)
OS로 비유 : 설치되어서 사용중인 OS

0개의 댓글

관련 채용 정보