Last active
November 9, 2015 02:20
-
-
Save nguyendangminh/ff32cf3de5194bbc8f6d to your computer and use it in GitHub Desktop.
Docker cookbook
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
# Installation | |
$ wget -qO- https://get.docker.com/ | sh | |
# Some useful commands | |
$ docker pull ubuntu:latest | |
$ docker images | |
$ docker ps | |
$ docker ps -a | |
$ docker run -it ubuntu:latest /bin/bash | |
$ docker run -it --name="my_docker_image" ubuntu:latest /bin/bash | |
$ docker commit -m "message" <image_name> | |
$ docker tag <image_id> <new_repos_name> | |
$ docker run -it -p 5000:5000 <repository>:<tag> /bin/bash | |
$ docker run -it -p 5000:5000 -v /host_dir:/container_dir <repository>:<tag> /bin/bash # mount | |
$ docker kill <docker_id> # the same as pausing | |
$ docker rm <docker_id> | |
$ docker rm $(docker ps -aq) # remove all stopped containers | |
# Docker hub | |
$ docker login | |
$ docker search ubuntu | |
$ docker pull minhnd/ubuntu | |
$ docker tag sample_repos minhnd/sample_repos | |
$ docker push minhnd/sample_repos:latest |
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
# | |
# Simple dockerfile | |
# | |
FROM ubuntu:latest | |
MAINTAINER MinhND "[email protected]" | |
RUN apt-get update | |
RUN apt-get install python python-pip wget | |
RUN pip install Flask | |
ADD hello.py /home/hello.py | |
WORKDIR /home | |
# Then run the following command for build new image | |
# $ docker build -t "flaskr:dockerfile" . | |
# $ docker run -p 5000:5000 flaskr:dockerfile python hello.py |
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
Error: | |
Post http:///var/run/docker.sock/v1.19/images/create?fromImage=<removed>: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS? | |
Solution: | |
Start the Docker service: $ sudo service docker start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment