목차 열기
티스토리 뷰
728x90
반응형
[Server/Linux] - Linux / INDEX
0. Image
이미지 목록
docker images
이미지 빌드
docker build -t [이미지이름]:[태그] .
. 은 dockerfile이 있는 위치일 때 사용한다.
이미지 실행
docker run \
- d [이미지이름] : 컨테이너를 분리 모드에서 실행 (백그라운드)
- p : [공개 포트]:[docker 내부 포트]
--name = [이름]
--network = [네트워크 설정]
--net = container:[컨테이너 ID 혹은 이름]
--restart = [재시작 설정] (unless-stopped)
--mount type=bind,source="$(pwd)",target=/[You Want]
- v : [시스템 디렉토리]:[내부 디렉토리]
- e : 환경 변수 설정
1. Container
컨테이너 목록
docker ps
-a : 모든 프로세스를 표시한다.
컨테이너 접속
sudo docker exec -it [컨테이너 ID] bash
ex) sudo docker exec -it nextcloud bash
sudo docker exec -it mariadb bash
컨테이너 삭제
docker (container) rm [컨테이너 ID]
2. Network
root@ubuntu:/# docker network --help
Usage: docker network COMMAND
Manage networks
Commands:
connect Connect a container to a network
create Create a network
disconnect Disconnect a container from a network
inspect Display detailed information on one or more networks
ls List networks
prune Remove all unused networks
rm Remove one or more networks
3. Logs
root@ubuntu:/# docker logs --help
Usage: docker logs [OPTIONS] CONTAINER
Fetch the logs of a container
Options:
--details Show extra details provided to logs
-f, --follow Follow log output
--since string Show logs since timestamp
(e.g. 2013-01-02T13:23:37Z)
or relative (e.g. 42m for 42 minutes)
-n, --tail string Number of lines to show from the end of the logs (default "all")
-t, --timestamps Show timestamps
--until string Show logs before a timestamp
(e.g. 2013-01-02T13:23:37Z)
or relative (e.g. 42m for 42 minutes)
4.
5.
6.
7.
728x90
반응형
'Server > Docker' 카테고리의 다른 글
[Docker] MySQL 실행 (0) | 2021.02.17 |
---|---|
[Docker] Node.js - nodemon으로 실시간 서버 재시작하기 (0) | 2021.02.16 |
[Docker] Node.js 이미지 제작 후 실행 (0) | 2021.02.16 |
[Docker error] Nextcloud 업로드 오류 / request entity too large (0) | 2021.02.04 |
[Docker] vim 설치 오류 (0) | 2021.02.04 |
[Docker] Nextcloud 실행 (0) | 2021.02.04 |
[Docker] MariaDB 실행 (0) | 2021.02.04 |
댓글