Most frequently used commands in docker
To view running containers
To go inside the running container
To view the container details
To view running containers
sudo docker psTo view the stopped and running containers
sudo docker ps -aTo view all the docker images
sudo docker imagesTo start the docker container
sudo docker start [container ID]To stop the container
sudo docker stop [container ID]To run tomcat image
sudo docker run -d -p 8081:8080 tomcat:8.0[-d for detached mode, -p to sepcify the ports, -P to automatically assign the port]
To go inside the running container
sudo docker exec -i -t [container ID] /bin/bash[-i to connect to the STDIN of the container, -t for pseudo terminal]
To view the container details
sudo docker inspect [container ID]To copy a file from host to the container
sudo docker cp file-web.war [container ID]:/usr/local/webappsTo build an image from the dockerfile
sudo docker build -t imageNameTo commit a docker image
sudo docker commit [containerID] [imageName]:[tag]To kill a docker container
sudo docker kill [containerID]
No comments:
Post a Comment