Skip to content

Instantly share code, notes, and snippets.

@davilera davilera/00-docker.md Secret
Last active Sep 26, 2019

Embed
What would you like to do?

Docker post.

sudo apt install docker.io docker-compose
sudo usermod -aG docker your-user
docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
d1725b59e92d: Pull complete
Digest: sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
53592cd94a6d hello-world "/hello" 2 seconds ago Exited (0) 2 seconds ago determined_feynman
docker rm 53592cd94a6d
version: '2'
services:
mysql:
image: mysql:5.7
restart: always
ports:
- 8081:3306
environment:
MYSQL_USER: wordpress
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
depends_on:
- mysql
image: wordpress
ports:
- 8080:80
restart: always
environment:
WORDPRESS_DB_HOST: mysql:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
docker-compose up -d
docker-compose stop
docker-compose down
version: '2'
services:
mysql:
image: mysql:5.7
restart: always
ports:
- 8081:3306
environment:
MYSQL_USER: wordpress
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
depends_on:
- mysql
image: wordpress
ports:
- 8080:80
restart: always
volumes:
- ./:/var/www/html/wp-content/plugins/nelio-content
environment:
WORDPRESS_DB_HOST: mysql:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
127.0.0.1 localhost
127.0.0.1 content.local
version: '2'
services:
nginx-proxy:
image: jwilder/nginx-proxy
restart: always
ports:
- 80:80
- 3306:3306
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
networks:
default:
external:
name: proxy
version: '2'
services:
mysql:
image: mysql:5.7
restart: always
ports:
- 8081:3306
environment:
MYSQL_USER: wordpress
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_PASSWORD: wordpress
networks:
- backend
wordpress:
depends_on:
- mysql
image: wordpress
ports:
- 8080:80
restart: always
volumes:
- ./:/var/www/html/wp-content/plugins/nelio-content
environment:
VIRTUAL_HOST: content.local
VIRTUAL_PORT: 8080
WORDPRESS_DB_HOST: mysql:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
networks:
- frontend
- backend
networks:
backend:
frontend:
external:
name: proxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.