It is said that if you do not know docker, it is dangerous, As a beginner, I'm not sure what docker is and what it's useful for. He bought a reference book, but I'm not sure what it says. For the time being, I wondered if I could understand something if I actually played with it.
I was learning to build a server on AWS, so I installed it on the instance I created at this time Try. If you don't understand it in the middle, you can reset it by terminating the instance. I thought, so I did it like this.
First, log in to your instance
% ssh -i key pair ec2-user@Domain name
__| __|_ )
_| ( / Amazon Linux 2 AMI
___|\___|___|
https://aws.amazon.com/amazon-linux-2/
Then install docker
$ sudo amazon-linux-extras install docker
It will stop once, so enter y to proceed and the installation will be completed. Try starting docker.
$ sudo service docker start
Redirecting to /bin/systemctl start docker.service
Set docker authority to ec2-user so that you do not have to add sudo at the time of operation.
$ sudo usermod -a -G docker ec2-user
Log out of the instance once to reflect the settings
$ exit
Log in to your instance again and check
$ systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running)since gold 2020-10-23 05:16:20 UTC; 5min ago
Docs: https://docs.docker.com
I wrote active (running) so it seems to work.
I've installed it for the time being, so I'm going to play around with it.
Recommended Posts