http://localhost:8080/hello
http://localhost:8080/
http://localhost:8080/health
-
docker build -f Dockerfile -t escortnotice/hello-openshift:v1.0 .
-f is for the docker file name
-t is the image tag name that will be build
. (DOT) represents the current directory where the project is present.
The above command will create a docker image.The docker image name should always be in lower case. This command should be run in the folder where the "Dockerfile" exists.
-
docker run --name hello-openshift-app -p 8080:8080 escortnotice/hello-openshift:v1.0
--name is used to give the name of the container
-p is for port(container:hostmachine) forwarding from the container to the host machine where the container runs
Then give the name of the image: from which you want to create the container.
-
now run the url in the browser "http://localhost:8080/hello"
docker images ls (to list all images)
docker image rm (to delete the image)
docker container ls (to check all containers running or stopped)
docker container ls --all (to check running containers)
docker container stop (to stop running containers)
docker container logs --tail 100 (print last 100 lines of a container's log)
docker container rm (delete a stopped container)
docker container rm -f $(docker ps -aq) {delete all stopped and running containers}
docker tag (to retag an image)
docker push (push an image to repository) ex: docker push escortnotice/hello-openshift:v1.0
docker pull