docker project part - 2

docker project part - 2

This blogs show the demonstration of docker pull, inspect, logs, stop, start and remove commands.

Table of contents

Tasks:

  1. Run docker commands as a non-root user (Hint- Use usermod command to give the user permission to docker). Make sure you reboot the instance after giving permission to the user.

  2. Pull a pre-existing Docker image from a public repository (e.g. Docker Hub) and run it on your local machine.

  3. Inspect the container's running processes and exposed ports using the docker inspect command.

  4. Use the docker logs command to view the container's log output.

  5. Use the docker stop and docker start commands to stop and start the container.

  6. Use the docker rm command to remove the container when you're done.

Solution:

  1. Run docker commands as a non-root user (Hint- Use usermod command to give the user permission to docker).

    1. Make sure you reboot the instance after giving permission to the user.

  2. Pull a pre-existing Docker image from a public repository (e.g. Docker Hub) and run it on your local machine.

    1. Pulling nginx from dockerhub.

  3. Inspect the container's running processes and exposed ports using the docker inspect command.

  4. Use the docker logs command to view the container's log output.

  5. Use the docker stop and docker start commands to stop and start the container.

  6. Use the docker rm command to remove the container when you're done.


This was the small tutorial on how to use docker with the CLI. Thanks for reading. Hope it finds you helpful. If you like the blog, do like, have any queries? do comment and share the blog.

You can also subscribe to the newsletter for updates on my blogs.

Follow me:

LinkedIn: linkedin.com/in/sonineelp