새소식

반응형
Tool/DocKer

도커(Docker) 컨테이너 무기한/무한 실행하는 방법

  • -
반응형

2024-02-07


사진: Unsplash 의 Jigar Panchal


1. pseudo-TTY

 

우선 pseudo-TTY를 알아야 하는데 이는 유저 또는 애플리케이션이 shell에 대한 권한을 얻기 위해 사용된다. pseudo-TTY는 master와 slave 두 개의 파일이 쌍을 이루어 구성되는데, master  파일은  OMVS 나 rlogin 같은 네트워크 애플리케이션에 사용되며, slave 은 터미널이나 쉘이 데이터를 읽기 위해 사용된다.

 

자세한 내용은 아래 참고

https://www.ibm.com/docs/en/zos/2.2.0?topic=files-pseudoterminal

 

Pseudoterminal files

Pseudoterminals (pseudo-TTYs) are used by users and applications to gain access to the shell. A pseudo-TTY is a pair of character special files, a master file and a corresponding slave file. The master file is used by a networking application such as OMVS

www.ibm.com


2. Docker pseudo-TTY

 

도커에서도 컨테이너에 pseudo-TTY 옵션( -t )을 주어 실행시킬 수 있는데, 이를 통해 컨테이너는 세션이 끝날때 까지 종료되지 않게 할 수 있다.

 

해당 옵션에 추가적으로 -d 옵션을 주어 실행 시키면 해당 컨테이너를 무기한 실행시킬 수 있게 된다.

docker run -d -t ubuntu

 

--detach -d   Run container in background and print container ID
--tty -t   Allocate a pseudo-TTY

 


3. 출처

 

https://www.baeldung.com/ops/running-docker-containers-indefinitely


메인 이미지 출처 : 사진: UnsplashJigar Panchal

반응형
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.