Strony

Wednesday, 7 June 2017

Docker - useful commands

#List running docker container's
docker ps

#List docker container's
docker ps -a

#Access shell of the container
docker exec -i -t id_of_container /bin/bash

#Stop docker container
docker stop id_of_container

#Commit changes done in docker container and save it to image
docker commit container_id name_of_the_docker_image

#Download docker image
docker pull name_of_the_docker_image

#Save docker image to tar file
docker save name_of_the_docker_image > /path_to_file/name_of_the_docker_image.tar

#Load docker image from the tar file
docker load -i /path_to_file/name_of_the_docker_image.tar

#Run docker container from image, container will run in background and container port will be #published
docker run -i -d -p host_port:container_port name_of_the_docker_image

No comments:

Post a Comment