docker lab 104}}

In this lab, we will be creating docker image with dockerfile and run a container using it

In case you prefer a video, check below our YouTube video for this lab

Create docker hub account. Docker Hub skip this step if you already have one

image

Open Play with Docker

image

login with your docker hub account.

imageClick on start play with docker startIt will start a 4 hr session play with kubernetes session
click on + ADD NEW INSTANCE

play with kubernetes node

Task: Create a Dockerfile to create a docker image

Solution
vi Dockerfile
FROM ubuntu

RUN apt-get update  

RUN apt-get install figlet  

CMD ["figlet", "hello docker"]  

Task: Build docker image with Dockerfile from previous step

Solution
docker image build -t imageformfile:0.1 .

Task: Run docker container with image build in previous step

Solution
docker container run imageformfile:0.1

Task: List all docker images on local system

Solution
docker image ls -a

Task: List all all changes made to docker image

Use image from previous step

Solution
docker image history <image ID>

Update you docker image with 0.2

Solution
vi Dockerfile
CMD ["figlet", "hello docker 0.2"]  

TasK: Build docker image with updated Dockerfile from previous step

update tag to 0.2

Solution
docker image build -t imageformfile:0.2 .

Task: Run docker container with image build in previous step

Solution
docker container run imageformfile:0.2

Task: Delete all open nodes/instances and close session

  1. Select the node and click on DELETE
  2. Repeat same for any other open nodes
  3. click close session

cleanup}}


Click on ‘Submit Feedback’ on the bottom left of the page to submit any questions/feedback.