728x90
반응형
Docker 공식 문서 사이트
🐋 docker search <IMAGE>
Docker Hub에서 image 찾기
(star가 많고, official이면 그 만큼 신뢰성 up!)
PS C:\Users> docker search wordpress
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
wordpress The WordPress rich content management system… 5089 [OK]
bitnami/wordpress Bitnami container image for WordPress 211 [OK]
🐋 docker pull <IMAGE>
image를 pull 하기 (다운로드하기)
PS C:\Users> docker pull wordpress
Using default tag: latest
latest: Pulling from library/wordpress
...
🐋 docker images
image 전체를 보여준다
PS C:\Users> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 9eeeeeeeeeee 44 hours ago 142MB
🐋 docker run <IMAGE>
image로 container를 실행시키기
PS C:\Users> docker run nginx
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
...
syntax) run의 실제 문법
docker run [OPTIONS] IMAGE [COMMAND]
대표적인 [OPTIONS] : --name <이름>
container의 이름 만들기
PS C:\Users> docker run --name hi wordpress
WordPress not found in /var/www/html - copying now...
...
PS C:\Users> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
78000d50ea05 wordpress "docker-entrypoint.s…" 9 seconds ago Up 8 seconds 80/tcp hi
대표적인 [COMMAND] : sleep
실행시켰다가 30초 뒤에 sleep(정지) 시키시
PS C:\Users> docker run wordpress sleep 30
🐋 docker ps
현재 가동중인 container를 보여준다
PS C:\Users> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
aaaaaaaaaaaa nginx:1.211111111 "/docker-entrypoint.…" 6 seconds ago Up 5 seconds 80/tcp thirsty_tharp
🐋 docker ps -a
-a(all) 모든 컨테이너 보여줌
PS C:\Users> docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1df8403e6de4 wordpress:latest "docker-entrypoint.s…" 12 minutes ago Up 12 minutes 80/tcp compassionate_solomon
🐋 docker logs <CONTAINER>
log를 보여준다
> docker logs hi
WordPress not found in /var/www/html - copying now...
Complete! WordPress has been successfully copied to /var/www/html
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
[Tue Feb 07 10:16:46.328454 2023] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.0.27 configured -- resuming normal operations
[Tue Feb 07 10:16:46.328506 2023] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
그냥 logs
는 보여주다 멈춘다
-f logs
로 하면 실시간으로 보여줌
PS C:\Users> docker logs -f hi
WordPress not found in /var/www/html - copying now...
Complete! WordPress has been successfully copied to /var/www/html
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
[Tue Feb 07 10:16:46.328454 2023] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.0.27 configured -- resuming normal operations
[Tue Feb 07 10:16:46.328506 2023] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
🐋 docker stop <CONTAINER>
실행 중인 container를 멈추기
PS C:\Users> docker stop compassionate_solomon
compassionate_solomon
🐋 docker start <CONTAINER>
중지시킨 container 다시 시작하기
PS C:\Users> docker stop inspiring_galileo
inspiring_galileo
PS C:\Users> docker start inspiring_galileo
inspiring_galileo
🐋 docker rm <CONTAINER>
container 아예 삭제하기 (먼저 stop 시키고 지우기)
PS C:\Users> docker stop inspiring_galileo
inspiring_galileo
PS C:\Users> docker rm inspiring_galileo
inspiring_galileo
🐋 docker rmi
image를 삭제하기
PS C:\Users> docker rmi 9eee96112def
Untagged: nginx:latest
Untagged: nginx@sha256:c54fb26749e49dc2df77c6155e8b5f0f78b781b7f0eadd96ecfabdcdfa5b1ec4
Deleted: sha256:9eee96112defa9d7b1880f18e76e174537491bcec6e31ad9a474cdea40f5abab
🐋 docker inspect
컨테이너에 관한 자세한 정보 획득
🐋 docker exec
실행중인 컨테이너에 새로운 명령어를 실행한다
🐋 docker attach
실행중인 도커 컨테이너에 표준 입출력으로 연결한다
🐋 docker container prune
정지 컨테이너 삭제
🐋 docker image prune
미사용 이미지 삭제
728x90
반응형
'Docker' 카테고리의 다른 글
[Docker] Dockerfiler 작성 방법 (이미지 만드는 법) (0) | 2023.04.14 |
---|---|
Docker의 네트워크 방식 (0) | 2023.02.08 |
[Docker] 도커와 컨테이너란? 아주 쉽게 설명!! (Container, Image) (0) | 2023.02.04 |