Docker
Docker
Docker
Docker Commands :-
docker run ubuntu
docker ps
docker ps -a
Stop a container :-
docker ps
identify the process id of the container
docker stop silly_sammet
Remove a Container :-
docker rm silly_sameet
docker ps -a
List of Images :-
docker images
Remove Images :-
docker rmi ubuntu
--> delete all dependeny containers to remove image.
(So first remove container then you can remove base image.)
Append a command :-
docker run ubuntu sleep 1000
Execute a command :-
Lets see I want to see a file in a running container.
docker ps --> take the container id or name suppose in this case Container name is
infallible_curie
cat /etc/*release*
exit
docker rm -f <conatainer_id>
docker run Ubuntu:17.04 --> to run another ubuntu having version 17.04
port mapping
http://172.17.0.2:5000
Volumne Mapping
docker run -v /opt/datadir:/var/lib/mysql mysql
Versioning :-
docker run ubuntu cat /etc/*release*/
what if I run another version of Ubuntu:-
So go to hub.docker and then check for the Supported Tags under ubuntu official
image.
If we want to save the Config of Jenkins in the Container then we have to map the
volume so that we can save the data in another volume for future purpose.