Docker
Docker
# docker ps
How to Jump in a Docker Container
Step1: PULL Docker Image from Docker HUB
http://localhost:8080
How to Create Docker Image
BUILD RUN
Dockerfile
# cat Dockerfile
FROM anapsix/alpine-java:8_jdk_nashorn
MAINTAINER AMIT GANVIR
RUN mkdir /myapp
COPY hello.jar /myapp/app.jar
CMD ["/java”, “-jar”, “/myapp/app.jar"]
http://localhost:8081
Lets make Docker Image tag
Step1: docker tag <Image Name/ID> <New IAMGE TAG repo/app:tag>
o When you use the docker pull or docker run commands, the required
images are pulled from your configured registry. When you use the docker
push command, your image is pushed to your configured registry
From Local
Internet
Docker Image
Docker Image
How to push Docker Image in Docker Registry
Step1: Create an account on Dockerhub registry - https://hub.docker.com
Step3: Login with credentials on your local machine. Don’t use your login password
instead use token
# docker login -u amitganvir6
OR
# docker login -u amitganvir6 –h https://hub.docker.com/repositories/amitganvir6
export DB_PASSWORD=1234
docker run -p 3306:3306 --name mariadb -e MARIADB_ROOT_PASSWORD=$DB_PASSWORD -itd
bitnami/mariadb:latest
http://localhost:5100
Docker command list
docker run – Runs a command in a new container
docker start – Starts one or more stopped containers
docker stop – Stops one or more running containers
docker build – Builds an image form a Docker file
docker login - To login on Container registry
docker pull – Pulls an image or a repository from a registry
docker push – Pushes an image or a repository to a registry
docker exec – Runs a command in a run-time container (-it)
docker ps - To list containers (-a)
docker images - To list all the local images
docker rm - to remove the container
docker rmi - To remove images
docker search - To search images on the registry
docker kill – To kill pods
docker export – Exports a container’s filesystem as a tar archive
docker search – Searches the Docker Hub for images
docker attach – Attaches to a running container
docker commit – Creates a new image from a container’s changes
Data Availabe in Github Repository
https://github.com/amitganvir23/devops-session
Present By Amit Ganvir
[email protected]