목표 : docker 컨테이너에 ubuntu를 받고 이것 저것 만져본다.
어디서 : 우분투, cmd 등 프로그램에서
어떻게: 리눅스 명령어를 입력해서
리눅스 커널과 배포판
- 배포판의 종류
우분투, 데비안, 알파인, 페도라, 센트os 등등 - 배포판에 따른 패키지 매니저
파이썬 : 우분투(apt, pip) , 데비안 (apt, pip), 알파인리눅스 (apt, pip), 페도라(dnf,pip), 센트os(yum,pip),
JavaScript(Node.js) : npm, yarn
C# 등의 언어 : NuGut
실습(진한글씨만 입력하는것)
- 우분투를 실행 (로컬에 없기 때문에 알아서 다운받는다)
weare@DESKTOP-BE1I4GE:~$ docker run ubuntu
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
a48641193673: Pull complete
Digest: sha256:6042500cf4b44023ea1894effe7890666b0c5c7871ed83a97c36c76ae560bb9b
Status: Downloaded newer image for ubuntu:latest
unable to upgrade to tcp, received 404 - 도커컨테이너 목록중에 우분투가 실행되는지 확인
weare@DESKTOP-BE1I4GE:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
실행 안된다. 그 이유는 동작완료하고 동작을 유지하지 않았기 때문 - -a를 추가해 완료된 도커 컨테이너도 확인
weare@DESKTOP-BE1I4GE:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d70342287a9a ubuntu "/bin/bash" 2 minutes ago Exited (0) 2 minutes ago stoic_lamarr - ubuntu 컨테이너 실행 및 nano 에디터 접속 시도
weare@DESKTOP-BE1I4GE:~$ docker run -it ubuntu
root@8334f78ad747:/# nano
bash: nano: command not found
root@8334f78ad747:/# apt install nano
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package nano is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'nano' has no installation candidate
root@8334f78ad747:/# apt update
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
Get:3 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [44.0 kB]
Get:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Get:5 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [1046 kB]
Get:6 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [109 kB]
Get:7 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [17.5 MB]
Get:8 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [1572 kB]
Get:9 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1326 kB]
Get:10 http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages [266 kB]
Get:11 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1792 kB]
Get:12 http://archive.ubuntu.com/ubuntu jammy/restricted amd64 Packages [164 kB]
Get:13 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [1602 kB]
Get:14 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1305 kB]
Get:15 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1599 kB]
Get:16 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 Packages [49.8 kB]
Get:17 http://archive.ubuntu.com/ubuntu jammy-backports/main amd64 Packages [50.4 kB]
Get:18 http://archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages [28.1 kB]
Fetched 28.9 MB in 1min 37s (300 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date. - ubuntu에 nano를 설치해봄
root@8334f78ad747:/# apt install nano
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
hunspell
The following NEW packages will be installed:
nano
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 280 kB of archives.
After this operation, 881 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 nano amd64 6.2-1 [280 kB]
Fetched 280 kB in 1s (198 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package nano.
(Reading database ... 4393 files and directories currently installed.)
Preparing to unpack .../archives/nano_6.2-1_amd64.deb ...
Unpacking nano (6.2-1) ...
Setting up nano (6.2-1) ...
update-alternatives: using /bin/nano to provide /usr/bin/editor (editor) in auto mode
update-alternatives: warning: skip creation of /usr/share/man/man1/editor.1.gz because associated file /usr/share/man/man1/nano.1.gz (of link group editor) doesn't exist
update-alternatives: using /bin/nano to provide /usr/bin/pico (pico) in auto mode
update-alternatives: warning: skip creation of /usr/share/man/man1/pico.1.gz because associated file /usr/share/man/man1/nano.1.gz (of link group pico) doesn't exist - nano 에디터 접속 해봄
root@8334f78ad747:/# nano - nano 삭제
root@8334f78ad747:/# apt remove nano
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
nano
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 881 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 4466 files and directories currently installed.)
Removing nano (6.2-1) ...
'docker(도커) 및 쿠버네티스' 카테고리의 다른 글
docker 컨테이너에 hangman 서비스 테스트 (0) | 2023.12.24 |
---|---|
docker 컨테이너 에서 MySQL 서버 실행하기 (0) | 2023.12.24 |
dockerhub 연동 실행, 수정 실습 (1) | 2023.12.24 |
dockerfile 구조, 만들어보기 (0) | 2023.12.23 |
Docker 프로그램 개발 과정 (1) | 2023.12.23 |