목차 열기

티스토리 뷰

728x90
반응형

[Server/Linux] - Linux / INDEX


0. Image
1. Container
2. Network
3. Logs
4. 
5. 
6. 
7. 

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 : 환경 변수 설정

 

#Index

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]

 

#Index

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

 

#Index

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)

 

#Index

4. 

#Index

5. 

#Index

6. 

#Index

7. 

#Index

 

728x90
반응형
댓글
글 보관함
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
Total
Today
Yesterday