# 把 <ec2-public-ip> 換成你的 EC2 的 Public IP $ ssh -i "your.pem" ec2-user@<ec2-public-ip>.compute-1.amazonaws.com , #_ ~\_ ######_ Amazon Linux 2 ~~ \_#######\ ~~ \####| AL2 End of Life is 2025-06-30. ~~ \#/ ___ ~~ V~' '-> ~~~ / A newer version of Amazon Linux is available! ~~._. _/ _/ _/ Amazon Linux 2023, GA and supported until 2028-03-15. _/m/' https://aws.amazon.com/linux/amazon-linux-2023/ [ec2-user]@your-ip ~ $
$ sudo docker version Client: Version: 20.10.25 ...
Server: Engine: Version: 20.10.25 ...
啟動我們的 Docker 服務。
1 2 3 4 5
$ sudo service docker start Redirecting to /bin/systemctl start docker.service
$ sudo systemctl enable docker.service Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
# 1. Get pip3 $ sudo yum install python3-pip Loaded plugins: extras_suggestions, langpacks, priorities, update-motd amzn2-core | 3.6 kB 00:00:00 Package python3-pip-20.2.2-1.amzn2.0.5.noarch already installed and latest version Nothing to do
# 2. Then run any one of the following $ pip3 install --user docker-compose Collecting docker-compose Downloading docker_compose-1.29.2-py2.py3-none-any.whl (114 kB) ... ... Successfully installed ... docker-compose-1.29.2 ...
# start the service $ sudo systemctl start docker.service # stop the service $ sudo systemctl stop docker.service # restart the service $ sudo systemctl restart docker.service # get the service status $ sudo systemctl status docker.service