docker project part - 2
This blogs show the demonstration of docker pull, inspect, logs, stop, start and remove commands.
Tasks:
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.Pull a pre-existing Docker image from a public repository (e.g. Docker Hub) and run it on your local machine.
Inspect the container's running processes and exposed ports using the docker inspect command.
Use the docker logs command to view the container's log output.
Use the docker stop and docker start commands to stop and start the container.
Use the docker rm command to remove the container when you're done.
Solution:
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.
Pull a pre-existing Docker image from a public repository (e.g. Docker Hub) and run it on your local machine.
Pulling nginx from dockerhub.
-
Inspect the container's running processes and exposed ports using the docker inspect command.
Use the docker logs command to view the container's log output.
Use the docker stop and docker start commands to stop and start the container.
-
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: