'IaC > Teraform on AWS' 카테고리의 다른 글
[Terraform on AWS] #1 - Terraform을 이용해 AWS 인프라환경을 구축 / VPC 생성 (0) | 2020.04.25 |
---|
[Terraform on AWS] #1 - Terraform을 이용해 AWS 인프라환경을 구축 / VPC 생성 (0) | 2020.04.25 |
---|
AWS 기초시리즈 #4 - AWS VPC를 구성해보자 - VPC란? (1) | 2020.06.05 |
---|---|
AWS - Cloudwatch custom metric을 이용한 Monitoring (Memory, Disk 사용량 확인) (0) | 2020.06.04 |
AWS - EC2 인스턴스 Auto Scheduled 백업 및 삭제방법 (0) | 2020.06.01 |
AWS 기초시리즈 #2 - AWS 가입, 계정 설정하기 (0) | 2020.04.24 |
AWS 기초시리즈 #1 - AWS 시작시 알아야 하는 용어 (0) | 2020.04.24 |
Terraform 기초 - Terraform이란? 테라폼 개념 및 설치 (windows기준) (0) | 2020.04.26 |
---|
다시 한번 말씀드리자면, Docker File이란 Docker Image를 만들기 위한 여러가지 명렁어의 집합입니다.
## 1. ubuntu 설치 & 2. 패키지 업데이트
# 테스트 ubuntu 서버를 사용하였기 때문에 패키지 업데이트를 먼저 합니다.
kbseo@KB-SEO:~$ sudo apt-get update
[sudo] password for kbseo:
Hit:1 http://mirror.kakao.com/ubuntu bionic InRelease
Get:2 http://mirror.kakao.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 http://mirror.kakao.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:4 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:5 http://mirror.kakao.com/ubuntu bionic-updates/main amd64 Packages [872 kB]
Get:6 http://mirror.kakao.com/ubuntu bionic-updates/main Translation-en [303 kB]
Get:7 http://mirror.kakao.com/ubuntu bionic-updates/restricted amd64 Packages [32.9 kB]
Get:8 http://mirror.kakao.com/ubuntu bionic-updates/restricted Translation-en [8468 B]
Get:9 http://mirror.kakao.com/ubuntu bionic-updates/universe amd64 Packages [1055 kB]
Get:10 http://mirror.kakao.com/ubuntu bionic-updates/universe Translation-en [326 kB]
Get:11 http://mirror.kakao.com/ubuntu bionic-updates/multiverse amd64 Packages [10.1 kB]
Get:12 http://mirror.kakao.com/ubuntu bionic-updates/multiverse Translation-en [4636 B]
Get:13 http://mirror.kakao.com/ubuntu bionic-backports/universe amd64 Packages [4028 B]
Get:14 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [651 kB]
Get:15 http://security.ubuntu.com/ubuntu bionic-security/main Translation-en [211 kB]
Get:16 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [23.8 kB]
Get:17 http://security.ubuntu.com/ubuntu bionic-security/restricted Translation-en [6528 B]
Get:18 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [648 kB]
Get:19 http://security.ubuntu.com/ubuntu bionic-security/universe Translation-en [215 kB]
Get:20 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [6756 B]
Get:21 http://security.ubuntu.com/ubuntu bionic-security/multiverse Translation-en [2700 B]
Fetched 4634 kB in 6s (739 kB/s)
Reading package lists... Done
kbseo@KB-SEO:~$
## 3. nginx 설치
kbseo@KB-SEO:~$ sudo apt-get install nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8 libnginx-mod-http-geoip
libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-stream libtiff5 libwebp6
libxpm4 nginx-common nginx-core
Suggested packages:
libgd-tools fcgiwrap nginx-doc ssl-cert
The following NEW packages will be installed:
fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8 libnginx-mod-http-geoip
libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-stream libtiff5 libwebp6
libxpm4 nginx nginx-common nginx-core
0 upgraded, 18 newly installed, 0 to remove and 239 not upgraded.
Need to get 2461 kB of archives.
After this operation, 8210 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
...
...
#이하 생략
#설치 확인
kbseo@KB-SEO:~$ nginx -v
nginx version: nginx/1.14.0 (Ubuntu)
kbseo@KB-SEO:~$
# 설치파일 경로
kbseo@KB-SEO:/etc/nginx$ pwd
/etc/nginx
여기서 잠깐
저희는 nginx를 패키지를 통하여 설치 하였기에 Default directory가 /etc/nginx 아래에 위치하게 됩니다. 직접 compile한 경우에 경로는 /usr/local/nginx/conf 혹은 /use/local/etc/nginx 에 위치하고 있습니다. 그래도 경로가 없다 한다면 다음의 명령어를 통해 찾을 수 있습니다.kbseo@KB-SEO:/etc/nginx$ sudo find / -name nginx.conf/etc/nginx/nginx.conf
kbseo@KB-SEO:/etc/nginx$ ls
conf.d fastcgi_params koi-win modules-available nginx.conf scgi_params sites-enabled uwsgi_params
fastcgi.conf koi-utf mime.types modules-enabled proxy_params sites-available snippets win-utf
# 기본적인 환경 설정 파일 정보는 sites-available/default 이곳에 있습니다.
# 따라서 웹서버의 루트 디렉토리 변경 등의 작업이 필요하다면 이곳에 들어가 작업하시면 됩니다.
kbseo@KB-SEO:/etc/nginx$ vim sites-available/default
# index.html 를 만든 후 찍어 봅니다.
kbseo@KB-SEO:/var/www/html$ sudo service nginx restart
* Restarting nginx nginx [ OK ]
kbseo@KB-SEO:/var/www/html$
kbseo@KB-SEO:/var/www/html$ curl 127.0.0.1
Hello KB
FROM ubuntu:14.04
MAINTAINER Dongbin Na "kbseo@osci.kr"
RUN apt-get update
RUN apt-get install -y nginx
WORKDIR /etc/nginx
CMD ["nginx", "-g", "daemon off;"]
EXPOSE 80
명렁어
|
내용
|
예시
|
|
FROM
|
- 베이스 이미지를 지정해줍니다.
|
FROM <image>:<tag>
|
FROM ubuntu:14.04
|
RUN
|
- 직접적으로 쉘 스크립트 내에서 실행 될 명령어 앞에 적어줍니다.
|
RUN <command>
|
RUN apt-get update
|
CMD
|
- 도커가 실행될 때 실행할 명령어를 정의해줍니다.
|
CMD ["executable", "param", "param"]
|
CMD ["nginx", "-g", "daemon off;"]
|
WORKDIR
|
- 이후 명령어가 작업할 디렉토리로 이동합니다
|
WORKDIR /path
|
WORKDIR /etc/nginx
|
COPY
|
- 파일이나 디렉토리를 이미지로 복사합니다
|
COPY <src> <dst>
|
COPY . /usr/src/app
|
ADD
|
- COPY와 비슷하게 복사를 위해 사용합니다
|
ADD <src> <dst>
|
ADD . /usr/src/app
|
EXPOSE
|
- 공개 하고자 하는 포트를 지정해줍니다
|
EXPOSE <port>
|
EXPOSE 80
|
[kbseo@ip-172-20-1-221 docker]$ docker build --force-rm --tag mynginx:0.1 .
Sending build context to Docker daemon 2.048kB
Step 1/7 : FROM ubuntu:14.0414.04: Pulling from library/ubuntu
2e6e20c8e2e6: Pull complete
30bb187ac3fc: Pull complete
b7a5bcc4a58a: Pull complete
Digest: sha256:ffc76f71dd8be8c9e222d420dc96901a07b61616689a44c7b3ef6a10b7213de4
Status: Downloaded newer image for ubuntu:14.04
---> 6e4f1fe62ff1
Step 2/7 : MAINTAINER Dongbin Na "kbseo@osci.kr"
---> Running in 224535a7dd96
Removing intermediate container 224535a7dd96
---> dc0f4b41cf96
Step 3/7 : RUN apt-get update
---> Running in 1e6d817f7aa0
...
...
Removing intermediate container 1e6d817f7aa0
---> bf2a670332b6
Step 4/7 : RUN apt-get install -y nginx
---> Running in b5fe65990ed8
...
...
Removing intermediate container b5fe65990ed8
---> 6664b9edcc36
Step 5/7 : WORKDIR /etc/nginx
---> Running in 34f5b2fe1f42
Removing intermediate container 34f5b2fe1f42
---> bc81d2ba24e1
Step 6/7 : CMD ["nginx", "-g", "daemon off;"]
---> Running in 45d49d210fea
Removing intermediate container 45d49d210fea
---> 44591f5b5a0c
Step 7/7 : EXPOSE 80
---> Running in b98221c6597d
Removing intermediate container b98221c6597d
---> 747275175211
Successfully built 747275175211
Successfully tagged mynginx:0.1
[kbseo@ip-172-20-1-221 docker]$
# 이미지확인
[kbseo@ip-172-20-1-221 docker]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mynginx 0.1 747275175211 12 minutes ago 231MB
registry latest 708bc6af7e5e 7 weeks ago 25.8MB
ubuntu 14.04 6e4f1fe62ff1 2 months ago 197MB
localhost:5000/hello-world latest fce289e99eb9 14 months ago 1.84kB
hello-world latest fce289e99eb9 14 months ago 1.84kB
[kbseo@ip-172-20-1-221 docker]$
Sending build context to Docker daemon 2.048kB <--- [1]
Step 1/7 : FROM ubuntu:14.04 <--- [2]
14.04: Pulling from library/ubuntu <--- [3]
---> 6e4f1fe62ff1 <--- [4]
Step 2/7 : MAINTAINER Dongbin Na "kbseo@osci.kr" <--- [5]
---> Running in 224535a7dd96 <--- [6]
Removing intermediate container 224535a7dd96 <--- [7]
---> dc0f4b41cf96 <--- [8]
Step 3/7 : RUN apt-get update <--- [9]
---> Running in 1e6d817f7aa0
...
Successfully built 747275175211 <--- [10]
# 재빌드
Sending build context to Docker daemon 2.048kB
Step 1/7 : FROM ubuntu:14.04
---> 6e4f1fe62ff1
Step 2/7 : MAINTAINER Dongbin Na "kbseo@osci.kr"
---> Using cache
---> dc0f4b41cf96
Step 3/7 : RUN apt-get update
---> Using cache
---> bf2a670332b6
Step 4/7 : RUN apt-get install -y nginx
---> Using cache
---> 6664b9edcc36
Step 5/7 : WORKDIR /etc/nginx
---> Using cache
---> bc81d2ba24e1
Step 6/7 : CMD ["nginx", "-g", "daemon off;"]
---> Using cache
---> 44591f5b5a0c
Step 7/7 : EXPOSE 80
---> Using cache
---> 747275175211
Successfully built 747275175211
참고로 명렁어를 주르륵 나열하기보단 최대한 간결하고 '&&' 명령어를 이용해 줄여서 적어주는것이 좋습니다! (스토리지 엔진에 따라 이미지 개수가 제한되는 경우도 있기때문)
#before[kbseo@ip-172-20-1-221 docker]$ docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEmynginx 0.1 747275175211 25 hours ago 231MBmynginx 0.2 747275175211 25 hours ago 231MB
#afterREPOSITORY TAG IMAGE ID CREATED SIZEkbseonginx 0.1 747275175211 25 hours ago 231MBmynginx 0.1 747275175211 25 hours ago 231MBmynginx 0.2 747275175211 25 hours ago 231MB
[Container 시리즈] 05. kubernetes란? Kubernetes 기초개념 (0) | 2020.06.04 |
---|---|
[Container 시리즈] 04. Application을 컨테이너화 해보자 (1) | 2020.05.27 |
[Container 시리즈] 02. Docker사용법 Docker Basic Command (0) | 2020.04.24 |
[Container 시리즈] 01. 도커를 설치하고 실행해보자! Docker on Amazon Linux (0) | 2020.04.24 |
[Container 시리즈] 00. Container란? Docker란? - 컨테이너, 도커 개념 (0) | 2020.04.24 |
nginx docker image를 여 registry로 부터 image pull, run, 그리고 삭제하는 과정에 대해 기술
|
# docker images 명령어를 통해 현재 가지고 있는 이미지 확인
[kbseo@ip-172-20-1-221 ~]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
# docker login
[kbseo@ip-172-20-1-221 ~]$ docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: kbseo
Password:
WARNING! Your password will be stored unencrypted in /home1/kbseo/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
# tag를 지정해주지 않으면 default로 latest 버전을 가져옵니다.
# tag를 지정할 경우
# docker pull nginx:latest
# 위의 명령어 대로 pull 가능
[kbseo@ip-172-20-1-221 ~]$ docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
bc51dd8edc1b: Pull complete
66ba67045f57: Pull complete
bf317aa10aa5: Pull complete
Digest: sha256:ad5552c786f128e389a0263104ae39f3d3c7895579d45ae716f528185b36bc6f
Status: Downloaded newer image for nginx:latest
[kbseo@ip-172-20-1-221 ~]$
# 이미지 확인
[kbseo@ip-172-20-1-221 ~]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 2073e0bcb60e 3 weeks ago 127MB
[kbseo@ip-172-20-1-221 ~]$
# docker ps 라는 명령어로 현재 실행중인 컨테이너를 확인합니다.
# docker ps -a -> 중지된 컨테이너까지 모두 출력
[kbseo@ip-172-20-1-221 ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
# docker run 이라는 명령어로 컨테이너를 실행시켜줍니다.
# docker run <옵션> <이미지 이름> <실행할 파일>
[kbseo@ip-172-20-1-221 ~]$ docker run -it -d -p 8080:80 --name=nginx nginx:latest
57c8f50ce8c565e7b8fcfbe3a730b4be9c7c0221606ee0ba7dc22295d1b8ae04
# 옵션 -i(interactive), -t(Pseudo-tty) -> Bash Shell에 입력 및 출력을 할 수 있습니다.
# 옵션 --name -> 컨테이너의 이름을 지정해 줍니다.
# 옵션 -d -> daemonized
# 옵션 -p -> 포트포워딩
[kbseo@ip-172-20-1-221 ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
57c8f50ce8c5 nginx:latest "nginx -g 'daemon of…" 4 seconds ago Up 3 seconds 0.0.0.0:8080->80/tcp nginx
[kbseo@ip-172-20-1-221 ~]$
[kbseo@ip-172-20-1-221 ~]$ curl http://localhost:8080
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
[kbseo@ip-172-20-1-221 ~]$
# 내부장벽진입
[kbseo@ip-172-20-1-221 ~]$ docker exec -it nginx /bin/bash
root@57c8f50ce8c5:/#
# 진입완료
# 컨테이너의 hostname을 알아봅시다
root@57c8f50ce8c5:/# hostname
57c8f50ce8c5
root@57c8f50ce8c5:/# cat /etc/issue
Debian GNU/Linux 10 \n \l
root@57c8f50ce8c5:/#
# Shell을 빠져나오려면 Ctrl + D 혹은 exit를 입력합니다.
# exit로 나왔을 경우 container 도 쉘 종료메세지(exit 0)을 받고 자연스럽게 종료 되기때문에
# docker start [컨테이더 ID ] 명령어로 재시작 혹은 ctrl+ p 혹은 ctrl + q 로 실행을 유지한 채
# 터미널로 빠져 나올 수 있습니다.
# docker rm 명령어를 통해 삭제합니다
# 컨테이너 삭제
[kbseo@ip-172-20-1-221 ~]$ docker rm nginx
Error response from daemon: You cannot remove a running container 57c8f50ce8c565e7b8fcfbe3a730b4be9c7c0221606ee0ba7dc22295d1b8ae04. Stop the container before attempting removal or force remove
# 어라? 삭제가 안되네요
# 먼저 중지를 해줍니다.
# I will find you and I will kill you...
[kbseo@ip-172-20-1-221 ~]$ docker kill nginx
nginx
# 다시삭제를 해봅니다.
[kbseo@ip-172-20-1-221 ~]$ docker rm nginx
nginx
[kbseo@ip-172-20-1-221 ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[kbseo@ip-172-20-1-221 ~]$
# 잘 삭제가 되네요
# docker rmi 명령어를 통해 이미지를 삭제해줍니다.
[kbseo@ip-172-20-1-221 ~]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 2073e0bcb60e 3 weeks ago 127MB
[kbseo@ip-172-20-1-221 ~]$
# $ docker rmi nginx:latest 혹은 $ docker rmi [ 이미지 ID ]
[kbseo@ip-172-20-1-221 ~]$ docker rmi nginx:latest
Untagged: nginx:latest
Untagged: nginx@sha256:ad5552c786f128e389a0263104ae39f3d3c7895579d45ae716f528185b36bc6f
Deleted: sha256:2073e0bcb60ee98548d313ead5eacbfe16d9054f8800a32bedd859922a99a6e1
Deleted: sha256:a3136fbf38691346715cac8360bcdfca0fff812cede416469653670f04e2cab0
Deleted: sha256:99360ffcb2da18fd9ede194efaf5d4b90e7aee99f45737e918113e6833dcf278
Deleted: sha256:488dfecc21b1bc607e09368d2791cb784cf8c4ec5c05d2952b045b3e0f8cc01e
[kbseo@ip-172-20-1-221 ~]$
[kbseo@ip-172-20-1-221 ~]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
# docker pull registry:latest
[kbseo@ip-172-20-1-221 ~]$ docker pull registry:latest
latest: Pulling from library/registry
486039affc0a: Pull complete
ba51a3b098e6: Pull complete
8bb4c43d6c8e: Pull complete
6f5f453e5f2d: Pull complete
42bc10b72f42: Pull complete
Digest: sha256:7d081088e4bfd632a88e3f3bcd9e007ef44a796fddfe3261407a3f9f04abe1e7
Status: Downloaded newer image for registry:latest
[kbseo@ip-172-20-1-221 ~]$
# 다운받은 이미지 Run
[kbseo@ip-172-20-1-221 ~]$ docker run -d -p 5000:5000 --restart=always --name docker-registry \
> -e REGISTRY_STORAGE=s3 \
> -e REGISTRY_STORAGE_S3_BUCKET=kbseo-s3 \
> -e REGISTRY_STORAGE_S3_ACCESSKEY=AKIAJMYYWQIA******* \
> -e REGISTRY_STORAGE_S3_SECRETKEY=YTOwsm0lDgghwjRHtR************ \
> -e REGISTRY_STORAGE_S3_REGION=ap-northeast-2 \
> registry
274a07c0c008d866e44215eb4b3626448e5ef11fa573acd69ecb3e000ebde7b2
[kbseo@ip-172-20-1-221 ~]$
# docker run -d -p 5000:5000 --restart=always --name docker-registr -> s3-registry 이미지 이름 지정 후 registry 기본포트 5000번으로 실행해줍니다
# -e SETTINGS_FLAVOR=s3 -> SETTINGS_FLAVOR는 s3로 설정해줍니다.
# -e AWS_BUCKET=kbseo-s3 -> 저장할 버킷이름을 지정해주세요
# -e STORAGE_PATH=/registry -> 저장될 경로입니다.
# -e AWS_KEY=AKIAJMYYWQIA******* -> IAM 혹은 루트계정의 Access Key를 입력해주세요
# -e AWS_SECRET=YTOwsm0lDgghwjRHtR************ -> IAM 혹은 루트계정의 Secret Key를 입력해주세요
docker run -d -p 5000:5000 --restart=always --name docker-registry \
-e REGISTRY_STORAGE=s3 \
-e REGISTRY_STORAGE_S3_BUCKET=kbseo-s3 \
-e REGISTRY_STORAGE_S3_ACCESSKEY=AKIAJMYYWQIA****** \
-e REGISTRY_STORAGE_S3_SECRETKEY=YTOwsm0lDgghwjRHtR************ \
-e REGISTRY_STORAGE_S3_REGION=ap-northeast-2 \
registry
# 어떤 이미지를 푸시해볼까....
[kbseo@ip-172-20-1-221 ~]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry latest 708bc6af7e5e 4 weeks ago 25.8MB
[kbseo@ip-172-20-1-221 ~]$
# 음.. 이미지를 다 지워서 push할 이미지가 없네요
# 만만한 hello-world 이미지를 받아봅니다.
[kbseo@ip-172-20-1-221 ~]$ docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:fc6a51919cfeb2e6763f62b6d9e8815acbf7cd2e476ea353743570610737b752
Status: Downloaded newer image for hello-world:latest
[kbseo@ip-172-20-1-221 ~]$
[kbseo@ip-172-20-1-221 ~]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry latest 708bc6af7e5e 4 weeks ago 25.8MB
hello-world latest fce289e99eb9 14 months ago 1.84kB
localhost:5000/hello-world latest fce289e99eb9 14 months ago 1.84kB
# tag를 지정해줍니다
# tag에 대해선 다음시간에 좀 더 자세히 다뤄보도록 하겠습니다.
[kbseo@ip-172-20-1-221 ~]$ docker tag hello-world localhost:5000/hello-world
# registry가 잘 돌아가고있네요
[kbseo@ip-172-20-1-221 ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
274a07c0c008 registry "/entrypoint.sh /etc…" 7 seconds ago Up 6 seconds 0.0.0.0:5000->5000/tcp docker-registry
[kbseo@ip-172-20-1-221 ~]$
# s3에 올려볼 차례
[kbseo@ip-172-20-1-221 ~]$ docker push localhost:5000/hello-world
The push refers to repository [localhost:5000/hello-world]
af0b15c8625b: Pushed
latest: digest: sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a size: 524
[kbseo@ip-172-20-1-221 ~]$
[Container 시리즈] 05. kubernetes란? Kubernetes 기초개념 (0) | 2020.06.04 |
---|---|
[Container 시리즈] 04. Application을 컨테이너화 해보자 (1) | 2020.05.27 |
[Container 시리즈] 03. Docker File, Docker Image - 도커파일 및 이미지에 대하여 (0) | 2020.04.24 |
[Container 시리즈] 01. 도커를 설치하고 실행해보자! Docker on Amazon Linux (0) | 2020.04.24 |
[Container 시리즈] 00. Container란? Docker란? - 컨테이너, 도커 개념 (0) | 2020.04.24 |
기존에 테스트용으로 사용하던 서버위에 설치
서버 환경 : Amazon Linux 2
서버 스펙 : t3.micro
|
[ec2-user@ip-172-20-1-221 ~]$ sudo yum -y upgrade
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core | 2.4 kB 00:00:00
amzn2extra-docker | 1.3 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package amazon-ssm-agent.x86_64 0:2.3.662.0-1.amzn2 will be updated
---> Package amazon-ssm-agent.x86_64 0:2.3.714.0-1.amzn2 will be an update
---> Package at.x86_64 0:3.1.13-23.amzn2 will be updated
...
sysstat.x86_64 0:10.1.5-18.amzn2.0.1 systemd.x86_64 0:219-57.amzn2.0.12
systemd-libs.x86_64 0:219-57.amzn2.0.12 systemd-sysv.x86_64 0:219-57.amzn2.0.12
systemtap-runtime.x86_64 0:4.2-1.amzn2.0.1 tcpdump.x86_64 14:4.9.2-4.amzn2.1
yum.noarch 0:3.4.3-158.amzn2.0.3
Replaced:
kpatch.noarch 0:0.4.0-3.amzn2 rpm-python.x86_64 0:4.11.3-25.amzn2.0.3
Complete!
[ec2-user@ip-172-20-1-221 ~]$ sudo amazon-linux-extras install -y docker
Installing docker
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Cleaning repos: amzn2-core amzn2extra-docker
10 metadata files removed
4 sqlite files removed
0 metadata files removed
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core | 2.4 kB 00:00:00
amzn2extra-docker | 1.3 kB 00:00:00
(1/4): amzn2-core/2/x86_64/updateinfo | 187 kB 00:00:00
(2/4): amzn2-core/2/x86_64/group_gz | 2.5 kB 00:00:00
...
===================================================================================================================================
Package Arch Version Repository Size
===================================================================================================================================
Installing:
docker x86_64 18.09.9ce-2.amzn2 amzn2extra-docker 30 M
Installing for dependencies:
containerd x86_64 1.2.6-1.amzn2 amzn2extra-docker 20 M
libcgroup x86_64 0.41-21.amzn2 amzn2-core 66 k
pigz x86_64 2.3.4-1.amzn2.0.1 amzn2-core 81 k
runc x86_64 1.0.0-0.1.20190510.git2b18fe1.amzn2 amzn2extra-docker 2.0 M
Transaction Summary
===================================================================================================================================
Install 1 Package (+4 Dependent packages)
Total download size: 51 M
Installed size: 214 M
Downloading packages:
(1/5): libcgroup-0.41-21.amzn2.x86_64.rpm | 66 kB 00:00:00
(2/5): pigz-2.3.4-1.amzn2.0.1.x86_64.rpm | 81 kB 00:00:00
(3/5): containerd-1.2.6-1.amzn2.x86_64.rpm | 20 MB 00:00:00
(4/5): runc-1.0.0-0.1.20190510.git2b18fe1.amzn2.x86_64.rpm | 2.0 MB 00:00:00
(5/5): docker-18.09.9ce-2.amzn2.x86_64.rpm | 30 MB 00:00:00
-----------------------------------------------------------------------------------------------------------------------------------
Total 75 MB/s | 51 MB 00:00:00
...
[ =1.8.0_192 =1.8.0_202 =1.8.0_212 =1.8.0_222 =1.8.0_232
=1.8.0_242 ]
28 firecracker available [ =0.11 ]
29 golang1.11 available \
[ =1.11.3 =1.11.11 =1.11.13 ]
30 squid4 available [ =4 ]
31 php7.3 available \
[ =7.3.2 =7.3.3 =7.3.4 =7.3.6 =7.3.8 =7.3.9 =7.3.10
=7.3.11 =7.3.13 ]
32 lustre2.10 available [ =2.10.5 =2.10.8 ]
33 java-openjdk11 available [ =11 ]
34 lynis available [ =stable ]
35 kernel-ng available [ =stable ]
36 BCC available [ =0.x ]
37 mono available [ =5.x ]
38 nginx1 available [ =stable ]
39 ruby2.6 available [ =2.6 ]
40 mock available [ =stable ]
41 postgresql11 available [ =11 ]
[ec2-user@ip-172-20-1-221 ~]$
# 버전확인
[ec2-user@ip-172-20-1-221 ~]$ docker --version
Docker version 18.09.9-ce, build 039a7df
[ec2-user@ip-172-20-1-221 ~]$
[ec2-user@ip-172-20-1-221 ~]$ sudo systemctl start docker
[ec2-user@ip-172-20-1-221 ~]$ ps -ef | grep docker
root 22846 1 1 08:23 ? 00:00:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --default-ulimit nofile=1024:4096
ec2-user 23025 4157 0 08:23 pts/0 00:00:00 grep --color=auto docker
[ec2-user@ip-172-20-1-221 ~]$ sudo systemctl start docker
[ec2-user@ip-172-20-1-221 ~]$ ps -ef | grep docker
root 22846 1 1 08:23 ? 00:00:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --default-ulimit nofile=1024:4096
ec2-user 23025 4157 0 08:23 pts/0 00:00:00 grep --color=auto docker
# 적용을 위하여 다시 ssh 재접속을 합니다
# exit로 나간뒤 접속 ㄱㄱ
# sudo 명령어 없이 실행해봅니다.
[ec2-user@ip-172-20-1-221 ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[ec2-user@ip-172-20-1-221 ~]$
# docker verision으로 각각의 버전확인 가능
[kbseo@ip-172-20-1-221 ~]$ docker version
Client:
Version: 18.09.9-ce
API version: 1.39
Go version: go1.10.3
Git commit: 039a7df
Built: Fri Nov 1 19:26:49 2019
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.09.9-ce
API version: 1.39 (minimum version 1.12)
Go version: go1.10.3
Git commit: 039a7df
Built: Fri Nov 1 19:28:24 2019
OS/Arch: linux/amd64
Experimental: false
[Container 시리즈] 05. kubernetes란? Kubernetes 기초개념 (0) | 2020.06.04 |
---|---|
[Container 시리즈] 04. Application을 컨테이너화 해보자 (1) | 2020.05.27 |
[Container 시리즈] 03. Docker File, Docker Image - 도커파일 및 이미지에 대하여 (0) | 2020.04.24 |
[Container 시리즈] 02. Docker사용법 Docker Basic Command (0) | 2020.04.24 |
[Container 시리즈] 00. Container란? Docker란? - 컨테이너, 도커 개념 (0) | 2020.04.24 |
OCI (Open Container Initiative)는? 컨테이너 포맷과 런타임에 대한 개방형 업계 표준을 만들기 위한 목적으로 Linux Foundation 의 지원으로 구성된 오픈 거버넌스 조직 (프로젝트)입니다. OCI는 2015년 6월 22일에 Docker 사와 CoreOS 사가 각각 별도로 표준화를 진행하고 있던 컨테이너의 규격을 통일하는 것을 목적으로 Docker, CoreOS 그리고 AWS, Google, Microsoft, IBM 등 주요 플랫폼 벤더가 참여하여 2015 년 6 월에 발족 한 단체이다. 즉, OCI 는 컨테이너 규격을 통일하는 것을 목적으로 만들어진 조직
여기에서! 도커이미지를 Docker Hub같은 Registry에 업로드 할때 PUSH라는 명령어를 쓰고 각 서버에서 이미지를 다운받을 때 이미지를 떙겨온다 해서 PULL이라는 명령어를 씁니다! 명령어는 다음시간에 자세히 다뤄보겠습니다~ (홍보주의)
[Container 시리즈] 05. kubernetes란? Kubernetes 기초개념 (0) | 2020.06.04 |
---|---|
[Container 시리즈] 04. Application을 컨테이너화 해보자 (1) | 2020.05.27 |
[Container 시리즈] 03. Docker File, Docker Image - 도커파일 및 이미지에 대하여 (0) | 2020.04.24 |
[Container 시리즈] 02. Docker사용법 Docker Basic Command (0) | 2020.04.24 |
[Container 시리즈] 01. 도커를 설치하고 실행해보자! Docker on Amazon Linux (0) | 2020.04.24 |
AWS 서비스를 사용하기 위해서는 계정부터 만들어야 겠지요?
이 페이지에서는 AWS 계정을 만드는 법을 설명해 드리도록 하겠습니다.
1. 계정만들기
01 ) 먼저, 아마존 웹 서비스(이하 AWS) 사이트에 접속합니다
콘솔 로그인창으로 바로 접속하셔도 무방합니다.
콘솔창으로 바로 들어오신분은 [AWS계정 새로만들기]를 클릭합니다
0 2 ) AWS 계정 생성 페이지로 들어옵니다.
필요한 빈칸을 모두 입력하여 줍니다.
이메일주소, 암호, 사용자가 지정하는 계정이름을 적고 하단의 주황색 버튼을 누릅니다.
0 3 ) 연락처 정보를 기입합니다.
우편번호는 나중에 비밀번호를 찾을때 사용될 수 있으니 따로 메모해두기를 권장해 드립니다.
추가적으로 해당사항은 영문으로 기입하여 주시길 바랍니다.
0 4 ) 결제정보를 입력합니다.
AWS 가입을 하는데 유료이진 않지만 서비스들을 사용한 만큼 지불하는 방식이기에
미리 결제할 카드를 지정해야 가입이 됩니다.
AWS같은경우 1년간 Free-tier로 정해진 규격내에서 무료로 이용가능하니때문에
Free-tier로 지원가능한 서비스를 확인하시고 사용하시기를 권장해드립니다. (추가적인 비용이 나가는것을 방지하기 위해)
AWS Free-tier란? : https://aws.amazon.com/ko/free/faqs/?ft=nf
Free-tier 지원영역 확인하기 : https://aws.amazon.com/ko/free/
0 5 ) 전화번호 인증을 거칩니다.
0 6 ) 지원플랜을 선택합니다.
사용자의 요구에 맞는 플랜을 선택합니다.
우선을 기본플랜으로 가입을 해보도록 하겠습니다.
0 7 ) 완료창 확인
가입이 잘 되었나 확인을 하기 위해 콘솔창으로 로그인을 해봅니다.
가입하였던 이메일과 암호를 입력하여 줍니다.
처음 가입하였을 시 루트 사용자가 되기때문에 상단에 루트사용자 로그인인지 확인하고 접속을 해줍니다.
입 시 내가 지정해준 이름으로 잘 로그인이 된걸 확인하실수 있습니다.
친절히 AWS측에서 가입축하 메일도 보내줍니다^0^
AWS 기초시리즈 #4 - AWS VPC를 구성해보자 - VPC란? (1) | 2020.06.05 |
---|---|
AWS - Cloudwatch custom metric을 이용한 Monitoring (Memory, Disk 사용량 확인) (0) | 2020.06.04 |
AWS - EC2 인스턴스 Auto Scheduled 백업 및 삭제방법 (0) | 2020.06.01 |
AWS 기초시리즈 #3 - AWS IAM 계정생성 (0) | 2020.04.25 |
AWS 기초시리즈 #1 - AWS 시작시 알아야 하는 용어 (0) | 2020.04.24 |