Docker Project for DevOps Engineers
Lets build the first ngnix container and see it is working or not?
So we will give command as -docker run -d -p 80:80 nginx:latest
Breakdown of the Command:
How to Verify:
After running the command, you can verify that the container is running and accessible by:
Opening a web browser and navigating to https://localhost or https://<your-host-ip>. You should see the default NGINX welcome page.
Running docker ps to see a list of running containers. You should see your NGINX container in the list.
Introducing the Dockerfile
A Dockerfile is like a recipe for creating a Docker container. It contains a set of instructions to build a container image. A Dockerfile is a script containing a series of instructions on how to build a Docker image. Each instruction in the Dockerfile corresponds to a command-line command that sets up your environment inside the Docker container. Docker uses this script to automate the process of creating a Docker image, which can then be run as a container.
So here lets us start to build docker file to deploy simple java project.
Build and Run the Docker Container
2. Run the Docker Container:
You can push your images to docker hub also by doing simple steps.
Use the command docker login to log in your Dockerhub
Add your credentials