Code Monkey home page Code Monkey logo

docker-cheatsheet's Introduction

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"
  • List all images
docker images
  • Remove all docker images
docker rmi -f $(docker images -a -q)
  • Remove a docker image
docker rmi ubuntu
  • Build a docker image by a Dockerfile
docker build -t example .
  • Run an image
docker run 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
  1. Go to docker hub site and create the repository, say 'hvrigazov/example'
  2. Create a Dockerfile locally and build it
  3. See the id of the image:
docker images
  1. Tag it:
docker tag e379ad0b10e0 hvrigazov/example:latest
  1. Login:
docker login
  1. Push
docker push hvrigazov/example

docker-cheatsheet's People

Contributors

hristo-vrigazov avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.