I have started an EC2 instance which is based on Amazon Linux2 AMI(HVM), SSD Volume Type. I want to install docker in that instance. I ran following command:
sudo yum update -y
sudo yum install -y docker
sudo chkconfig docker on
chkconfig --list docker
I get following message in my putty session:
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
error reading information on service docker: No such file or directory
I think Docker got installed alright, but it is not starting.Because in putty log I find
Installed:
docker.x86_64 0:18.06.1ce-8.amzn2
When I gave the command
sudo chkconfig docker on
putty told me:
Note.Forwarding request to 'systemctl enable docker.service'
So I even tried
sudo systemctl enable docker.service
Do I have to use some other AMI?
If you are using ECS, unless you have a reason to use a custom AMI, you should be using a supported ECS optimised AMI. These AMI are pre-configured with docker and all other ecs requirements:
The Amazon ECS-optimized AMIs are preconfigured with these requirements and recommendations. We recommend that you use the Amazon ECS-optimized Amazon Linux 2 AMI for your container instances unless your application requires a specific operating system or a Docker version that is not yet available in that AMI.
See https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html