In this lab we will practice, command to operate docker contianer
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 oneOpen Play with Docker
login with your docker hub account.
Click on start
It will start a 4 hr session
click on + ADD NEW INSTANCETask: Run a docker container with image nginx and expose port 80 as 8080
Solution
docker run -p 8080:80 nginx
Task: List all docker containers
Solution
Task: Start container from previous step
Solution
docker start <container id>
Task: Stop container from previous step
Solution
docker stop <container id>
Task: Run a docker container with image nginx and expose port 80 as 8080 and name it app1
Solution
docker run --name app1 -d -p 8080:80 nginx
Task: Check logs from docker container we created in previous step
Solution
Task: Restart container from previous step
Solution
Task: Check process running inside docker container we created in previous steps
Solution
Task: Kill container from previous step
Solution
Task: Remove container from previous step
Solution
Task: Delete all open nodes/instances and close session
- Select the node and click on DELETE
- Repeat same for any other open nodes
- click close session
Click on ‘Submit Feedback’ on the bottom left of the page to submit any questions/feedback.