Last active
October 26, 2017 13:40
-
-
Save hfogelberg/b6ec1ef216fcdbf891b3822d90b546cc to your computer and use it in GitHub Desktop.
This file contains 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
## Installing | |
$ docker version | |
$ docker run hello-world // Runs the Hello World sample. Downloads from Dockerhub if it isn't available locally | |
$ docker ps -a // Prints out all available containers on local machine | |
$ docker ps // Prints out all running containers on local machine | |
## Searching and runing | |
$ docker search whalesay | grep docker // Searches docker hub and filters with grep | |
$ docker run docker/whalesay cowsay Hello | |
$ docker images // Prints out list of all local images. Docker makes containers out of images | |
## Remove image | |
$ docker image rm -f a50e3329bb40 // Docker id, given by running docker images | |
## Create an image | |
1. Create Dockerfile (must have that name), eg: | |
FROM docker/whalesay:latest | |
RUN apt-get -y update && apt-get install -y fortunes | |
CMD /usr/games/fortune -a | cowsay | |
2. Build image | |
$ docker build -t henrik-whalesay . | |
3. Run | |
$ docker run henrik-whalesay | |
## Run web app | |
$ docker run -d -p 80:80 going-docker | |
One liner to stop / remove all of Docker containers: | |
$ docker stop $(docker ps -a -q) | |
$ docker rm $(docker ps -a -q) | |
## Docker on Zeit | |
1. Create Dockerfile. It must include the line EXPOSE 80 (or whatever port should be used). | |
2. Deploy by typing $ now | |
If the application uses any enviroment variables they are set like this: | |
$ now -e PASSWORD="fsdjfsf" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment