This repository was archived by the owner on Aug 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Docker Tricks
Rodrigo Dlugokenski edited this page Mar 13, 2018
·
63 revisions
Base directory for mounting
mkdir -p ~/Projects/docker
cd ~/Projects/docker
Considering that $PWD is the base directory
Running Traefik as HTTP Proxy server
mkdir traefik
curl https://raw.githubusercontent.com/containous/traefik/master/traefik.sample.toml > traefik/traefik.toml
docker run -d \
--name traefik \
--publish 80:80 \
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
--mount type=bind,source=$PWD/traefik/traefik.toml,target=/traefik.toml \
--label traefik.port=8080 \
--label traefik.frontend.rule=Host:monitor.localhost \
traefik \
--docker \
--docker.domain=localhost \
--docker.watch \
--web
You can now use http://monitor.localhost to observe your requests.
Portainer as Docker GUI
mkdir portainer
docker run -d \
--name portainer \
--mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
--mount type=bind,src=$PWD/portainer,dst=/data \
--label traefik.port=9000 \
portainer/portainer \
-H unix:///var/run/docker.sock
You can now use http://portainer.localhost to manage your Docker containers.
mkdir mysql
docker run -d \
--name mysql \
-p 3306:3306 \
-v $PWD/mysql:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD="MY ROOT PASSWORD" \
--memory 384000000 \
mysql:5.7
Memory: Limit memory usage in bytes
It exposes port 3306 to your host computer (and potentially to your network if your host is not firewalled). Now you can install a compatible mysql client in your host OS.
For ArchLinux: pacman -S percona-server-clients or pacman -S mariadb-clients