Exercise Basic Docker Commands

Let us Start

Table of Contents

Install docker on amazon linux

Instructions on how to install Docker on Amazon Linux:

Update the installed packages and package cache on your instance

yum update -y

Install the most recent Docker Community Edition package

yum install docker -y 

Start the Docker service

Add the ec2-user to the docker group so you can execute Docker commands without using sudo

Verify the docker version

Show the Docker Version, how to check the installed version of Docker:

Check Docker version

Search for Docker images on Docker Hub using the docker search command. For example, to search for Ubuntu images:

Search for Ubuntu images

How to run a container from an image

Run a container

Listing Containers

List all running containers

List all containers, even those not running

List all container IDs

How to stop a container

Stop a container

How to remove a container

Remove a container

Remove all containers

Last updated