I tried installing docker on an EC2 instance

Background

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.

Installation

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.

next

I've installed it for the time being, so I'm going to play around with it.

Recommended Posts

I tried installing docker on an EC2 instance
I tried installing CentOS 8 on ESXi 6.7
I tried running Docker on Windows Server 2019
Microservices 101-I tried putting Docker on Ubuntu-
Error installing ruby execution environment on EC2 instance
I installed Docker on EC2 and started it
I tried running Ansible on a Docker container
How to install Ruby on an EC2 instance on AWS
Deploy laravel using docker on EC2 on AWS ① (Create EC2 instance)
I tried installing the Docker Integration plugin in IntelliJ
I tried using Docker Desktop for Windows on Windows 10 Home
[Docker] Build an Apache container on EC2 using dockerfile
I tried to build an environment using Docker (beginner)
I tried the Docker tutorial!
Install docker on AWS EC2
I tried BIND with Docker
I tried installing Ruby on Rails related plugin with vim-plug
I tried to make an introduction to PHP + MySQL with Docker
How to create an application server on an EC2 instance on AWS
I tried to create React.js × TypeScript × Material-UI on docker environment
I tried running a Docker container on AWS IoT Greengrass 2.0
I tried running WordPress with docker preview on M1 Mac.
I tried deploying a Docker container on Lambda with Serverless Framework
How to create a web server on an EC2 instance on AWS
Launch docker container on EC2 (personal memorandum)
I tried to make an automatic backup with pleasanter + PostgreSQL + SSL + docker
I tried using Scalar DL with Docker
I installed Docker on my Raspberry Pi 3
Starting with installing Docker on EC2 and running Yellowfin in a container
Summary of Docker understanding by beginners ⑤ ~ Until deploying docker container on EC2 instance ~
I tried to build AdoptOpenjdk 11 on CentOS 7
What is Docker? I tried to summarize
Build an environment with Docker on AWS
Build an Ultra96v2 development environment on Docker 1
I tried migrating the portfolio created on Vagrant to the Docker development environment
[First environment construction] I tried to create a Rails 6 + MySQL 8.0 + Docker environment on Windows 10.
Building an environment for WordPress, MySQL and phpMyAdmin with Docker Compose on EC2
I tried using Docker for the first time
I tried putting Java on my Mac easily
I tried to verify AdoptOpenJDK 11 (11.0.2) with Docker image
Browse an instance of Tab's View on Android
I was addicted to installing Ruby/Tk on MacOS
I tried OmniSci on CentOS 7 + GeForce RTX 2080 Ti.
I tried to develop an application in 2 languages
I tried running Java on a Mac terminal
I tried Getting Started with Gradle on Heroku
Liberty on Docker
Bad Gateway came out when I tried to connect Grafana and InfluxDB on Docker
I tried Spring.
I tried tomcat
I tried refactoring ①
Notes on errors that occur when installing the JDK and countermeasures that I have tried
I tried FizzBuzz.
EC2 on Docker-compose
I tried JHipster 5.1
Redmine on Docker
Install docker-compose on a Graviton 2 instance of AWS EC2
I built an Ubuntu environment on Windows 10 using WSL2.
I tried to summarize the state transition of docker
I tried using Log4j2 on a Java EE server
I tried using YOLO v4 on Ubuntu and ROS