Quick commands for docker
- Run bash inside a container
docker run -it tsutomu7/python-opencv bash
- Remove all docker containers
docker rm $(docker ps -a -q)
- Stop all docker containers
docker stop $(docker ps -a -q)
- Connect docker container to your display
docker run -it --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" tsutomu7/python-opencv
- Connect docker container port to your port
docker run -it -p 1880:1880 --name mynodered nodered/node-red-docker
- Copy current folder into docker container's home folder
docker cp . 61e6ed03aa66:/home/scientist/.
- Run a container connected to your display with given name
xhost local:root
docker run -it --name opencv --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" tsutomu7/python-opencv
- Find the id of a container by name
sudo docker ps -aqf "name=opencv"
docker rmi -f $(docker images -a -q)
- Build a docker image by a Dockerfile
docker build -t example .
- Tag an existing local image
docker tag e379ad0b10e0 hvrigazov/example:latest
- Steps needed to create a docker image and push it to docker hub
- Go to docker hub site and create the repository, say 'hvrigazov/example'
- Create a Dockerfile locally and build it
- See the id of the image:
- Tag it:
docker tag e379ad0b10e0 hvrigazov/example:latest
- Login:
- Push
docker push hvrigazov/example