Now that I've finally started learning Docker, I'll summarize my understanding. However, this time it's almost not related to docker.
Only this. It looks like this when it is represented in a diagram (uselessly annoying).
I always select the ʻus-east-2` region. There is no particular meaning.
CIDR blocks need to be considered firmly in the development scene, but here, 10.0.0.0/24
is specified appropriately. I recommend /16
or / 24
, which have good sharpness.
Tenancy doesn't seem to have to worry about personal development, whether it occupies resources or not.
Created.
Then attach it to the VPC you created earlier.
Only this yet.
Create a subnet in the VPC you created earlier.
CIDR block is set to / 28
. You can now have 2 ^ (32-28) -5 = 11
IP addresses in your subnet.
Also, AZ is set to ʻus-east-2a`.
Also, enable automatic allocation of public IPv4 addresses for subnets.
I'm here.
Create a route table in the VPC you created earlier.
Associate the created route table with the subnet created earlier.
Set up a route to the IGW so you can connect to the Internet.
I went a little.
For the AMI, select the free tier ʻAmazon Linux2. For the instance type, select the free frame
t2.micro`.
In the advanced instance settings, select the VPC and subnet you created earlier. Also, enable the auto-assigned public IP. Other options are not set this time.
Storage is OK with the default EBS settings.
Set the tag appropriately
Set up a security group. Allows all inbound communication between SSH and HTTP, and allows all communication outbound.
If you don't have a key pair, make a new one.
I'm finally here.
Select the target instance on the EC2 console and press the "Connect" button to display the screen below. Basically just follow this.
Assuming that the key pair is saved in ~ / Downloads
, you can connect with the following command.
cd ~
mv Downloads/ec2-key.pem .ssh/
cd .ssh/
chmod 400 ec2-key.pem
ssh -i "ec2-key.pem" ec2-user@<your-ec2-public-ip>
chmod
this article was very helpful. Thank you very much.I've almost reached the goal. (No, maybe it's a start)
sudo yum -y update
sudo yum install -y docker
sudo gpasswd -a $USER docker
sudo service docker start
If you log in again, you can use docker.
You also need to install docker-compose, so install it according to the Official Documents.
sudo -i
curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
exit
You can now install it. Goal for the time being.
You can save an image containing all the settings with docker installed as an AMI. With it, you don't need to install docker the next time you launch an EC2 instance. You can create an AMI by action from the instance setting screen.
After all it was not related to docker. It's almost an article on the basics of EC2. Thank you very much.
Recommended Posts