Last active
May 11, 2018 01:10
-
-
Save filiperfernandes/034bd89645eea40b5f1d52262d19e81c to your computer and use it in GitHub Desktop.
Docker commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Install docker script | |
| curl -sSL https://get.docker.com |sh | |
| #Get docker up and running | |
| - Start docker: | |
| ``` | |
| $ sudo systemctl start docker | |
| ``` | |
| - Add your user (pi) to docker group | |
| ``` | |
| $ sudo usermod -aG docker pi | |
| ``` | |
| ----------------------- | |
| #Dockerfile -> run shellf script | |
| RUN /bin/bash -c "source /usr/local/bin/virtualenvwrapper.sh" | |
| #Dockerfile -> create new user | |
| RUN useradd -ms /bin/bash newuser | |
| #Remove <none> images | |
| docker rmi $(docker images -f “dangling=true” -q) | |
| #Start container on bash shell | |
| docker run -it -d shykes/pybuilder /bin/bash | |
| #Run shell command on running container | |
| docker exec -it <container_id_or_name> echo "Hello from container!" | |
| #Copy files/folder to/from docker container | |
| docker cp foo.txt mycontainer:/foo.txt | |
| docker cp mycontainer:/foo.txt foo.txt | |
| docker cp src/. mycontainer:/target | |
| docker cp mycontainer:/src/. target | |
| #Remove all docker containers | |
| docker rm $(docker ps -a -q) | |
| #Docker run witl ALSA sound output (example) | |
| docker run -ti --privileged --rm -v /dev/snd:/dev/snd filiperfernandes/ai-domotics:v2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment