Wednesday, 30 August 2017

docker cheat sheet



docker login <url of docker> -> to login docker
docker images
docker tag <image:tag> <docker path/any name/image:tag>
docker push <image:tag> <docker path/any name/image:tag>
Ex- docker push <docker url>/prasantabehera/centos:7
docker ps
docker exec -it <id> bash (will log in to docker with prompt)
docker run --privileged -d -ti -e "container=docker"  -v /sys/fs/cgroup:/sys/fs/cgroup <image-id> /usr/sbin/init (with sudo access)
docker run -dit --name <container new name> <image-id> bash

docker rm
dokcer rmi - remove docker images
docker ps - will list out the container..
docker images - list out the image
docker run -d -p 80:80 <container name> /usr/sbin/apache2ctl -D FOREGROUND - (runs a container from image with port forwarding)
docker system prune -a  ==> it will remove both unused and dangling images.
dokcer stop
dokcer start
docker attach <docker id> - For relogin

docker commit -m "textsss"
docker images
docker stop <image id> <image id> ....
docker build . ('Dockerfile' should be there)
docker build -f /path/to/a/Dockerfile .

No comments:

Prasanta Kumar Behera. Mob- 8147470101