EC2를 개발 공부용으로 시작한다. 순전히 개밥먹기용으로 비용만을 고려하여 us-east1 에 , 아미존 리눅스 t4g.nano로 시작한다. t4g는 Arm64 계열이고 비용은 더 싸고, 성능은 더 좋다. 그러나 호환성 이슈가 있을 수 있고 직접 해결해야 한다. 10기가 EBS(1달에 1000원 정도 예상)를 붙였다.
아마존 LINUX를 사용하므로 https://stackoverflow.com/questions/63708035/installing-docker-compose-on-amazon-ec2-linux-2-9kb-docker-compose-file 를 참고..
도커 설치
sudo yum update -y
sudo yum install docker
sudo service docker start
# docker를 sudo없이 사용하기위해서
sudo usermod -a -G docker ec2-user
docker info로 동작 확인
[ec2-user@ip-172-31-28-80 ~]$ docker info
Client:
Version: 25.0.3
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.0.0+unknown
Path: /usr/libexec/docker/cli-plugins/docker-buildx
Server:
ERROR: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/info": dial unix /var/run/docker.sock: connect: permission denied
errors pretty printing info
https://github.com/occidere/TIL/issues/116 참고해서 에러 해결
[ec2-user@ip-172-31-28-80 ~]$ ls -al /var/run/docker.sock
srw-rw----. 1 root docker 0 May 17 11:19 /var/run/docker.sock
[ec2-user@ip-172-31-28-80 ~]$
[ec2-user@ip-172-31-28-80 ~]$
[ec2-user@ip-172-31-28-80 ~]$ sudo chmod 666 /var/run/docker.sock
[ec2-user@ip-172-31-28-80 ~]$ ls -al /var/run/docker.sock
srw-rw-rw-. 1 root docker 0 May 17 11:19 /var/run/docker.sock
[ec2-user@ip-172-31-28-80 ~]$ docker info
Client:
Version: 25.0.3
Context: default
도커 컴포즈 설치
sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose version
실행 캡처
[ec2-user@ip-172-31-28-80 ~]$ sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 58.4M 100 58.4M 0 0 136M 0 --:--:-- --:--:-- --:--:-- 136M
[ec2-user@ip-172-31-28-80 ~]$ sudo chmod +x /usr/local/bin/docker-compose
[ec2-user@ip-172-31-28-80 ~]$ docker-compose version
Docker Compose version v2.27.0
도커 hello world
ec2-user@ip-172-31-28-80 ~]$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
478afc919002: Pull complete
Digest: sha256:266b191e926f65542fa8daaec01a192c4d292bff79426f47300a046e1bc576fd
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(arm64v8)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
bun 자바스크립트 런타임 설치
https://bun.sh/docs/installation 를 참고
[ec2-user@ip-172-31-28-80 ~]$ curl -fsSL https://bun.sh/install | bash
######################################################################## 100.0%
bun was installed successfully to ~/.bun/bin/bun
Added "~/.bun/bin" to $PATH in "~/.bashrc"
To get started, run:
source /home/ec2-user/.bashrc
bun --help
[ec2-user@ip-172-31-28-80 ~]$ source /home/ec2-user/.bashrc
[ec2-user@ip-172-31-28-80 ~]$ bun --version
1.1.8