Skip to content

Instantly share code, notes, and snippets.

@Serhioromano
Last active July 7, 2022 14:00
Show Gist options
  • Save Serhioromano/efff91b0a80b7c0df651068fce6a9ebf to your computer and use it in GitHub Desktop.
Save Serhioromano/efff91b0a80b7c0df651068fce6a9ebf to your computer and use it in GitHub Desktop.
Docker templates

MySQL

docker run -d --restart unless-stopped
--name mysql5
-e MYSQL_ROOT_PASSWORD=root
-e MYSQL_USER=sergey
-e MYSQL_PASSWORD=123456
-p 3305:3306
-v /share/BACKUPS/DockerVolumes/MySQL5/mysql:/var/lib/mysql
-v /share/BACKUPS/DockerVolumes/MySQL5/mysql_conf:/etc/mysql/conf.d
mysql:5.7

docker run -d --restart unless-stopped --name mysql5 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_USER=sergey -e MYSQL_PASSWORD=123456 -p 3305:3306 -v /share/BACKUPS/DockerVolumes/MySQL5/mysql:/var/lib/mysql -v /share/BACKUPS/DockerVolumes/MySQL5/mysql_conf:/etc/mysql/conf.d mysql:5.7

MSSQL

docker run -d --restart unless-stopped
--name mssql
--user root
-e ACCEPT_EULA=Y
-e MSSQL_SA_PASSWORD=Radar1234
-p 1433:1433
-v /share/BACKUPS/DockerVolumes/MSSQL/data:/var/opt/mssql/data
-v /share/BACKUPS/DockerVolumes/MSSQL/log:/var/opt/mssql/log
-v /share/BACKUPS/DockerVolumes/MSSQL/secrets:/var/opt/mssql/secrets
mcr.microsoft.com/mssql/server:2019-latest

PMA

docker run -d --restart unless-stopped
--name pma5
-e PMA_ARBITRARY=1
-e PMA_HOST=10.0.3.1
-e PMA_PORT=3305
-e PMA_USER=root
-e PMA_PASSWORD=root
-e TZ=Asia/Bishkek
-p 8015:80
-v /share/BACKUPS/DockerVolumes/PMA/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php
phpmyadmin/phpmyadmin:latest

docker run -d --restart unless-stopped --name pma5 -e PMA_ARBITRARY=1 -e PMA_HOST=10.0.3.1 -e PMA_PORT=3305 -e PMA_USER=root -e PMA_PASSWORD=root -e TZ=Asia/Bishkek -p 8015:80 -v /share/BACKUPS/DockerVolumes/PMA/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php phpmyadmin/phpmyadmin:latest

Connect to MySQL from host

mysql -h 127.0.0.1 -u root -P 3306 -p
mysql -h 192.168.1.3 -u root -P 3306 -p

Connect to mysql from another docker container

mysql -h host.docker.internal -u root -P 3306 -p
mysql -h 172.17.0.3 -u root -P 3306 -p

To get IP address of MySQL container

docker ps
docker inspect ID

Templates

version: '3'

services:
  mssql:
    container_name: MSSQLExpress
    image: mcr.microsoft.com/mssql/server:2019-latest
    restart: unless-stopped
    privileged: true
    ports:
      - 1433:1433
    volumes:
      - /share/SERGEY/DockerVolumes/MSSQL/sql_data:/var/opt/mssql/data
      - /share/SERGEY/DockerVolumes/MSSQL/sql_log:/var/opt/mssql/log
      - /share/SERGEY/DockerVolumes/MSSQL/sql_secret:/var/opt/mssql/secrets
    environment:
      ACCEPT_EULA: Y
      SA_PASSWORD: Root1234
      MSSQL_PID: Express
      TZ: Asia/Bishkek
 docker run -d --restart unless-stopped --name mysql5 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_USER=sergey -e MYSQL_PASSWORD=123456 -v /share/BACKUPS/DockerVolumes/MySQL5/mysql:/var/lib/mysql -v /share/BACKUPS/DockerVolumes/MySQL5/mysql_conf:/etc/mysql/conf.d mysql:5.7
  mysql5:
    container_name: MySQL5
    image: mysql:5.7
    restart: unless-stopped
    privileged: true
    ports:
      - 3305:3306
    volumes:
      - /share/SERGEY/DockerVolumes/MySQL5/mysql:/var/lib/mysql
      - /share/SERGEY/DockerVolumes/MySQL5/mysql_conf:/etc/mysql/conf.d
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USER: sergey
      MYSQL_PASSWORD: 123456
      TZ: Asia/Bishkek
  phpmyadmin5:
    image: phpmyadmin/phpmyadmin:latest
    restart: unless-stopped
    ports:
      - 8015:80
    volumes:
      -/share/SERGEY/DockerVolumes/PMA/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php
    environment:
      PMA_ARBITRARY: 1
      PMA_HOST: 192.168.1.2
      PMA_PORT: 3305
      PMA_USER: root
      PMA_PASWORD: root
      TZ: Asia/Bishkek
version: '3'

services:
  mssql:
    container_name: MSSQLExpress
    image: mcr.microsoft.com/mssql/server:2019-latest
    restart: unless-stopped
    privileged: true
    ports:
      - 1433:1433
    volumes:
      - /share/SERGEY/sql_data:/var/opt/mssql/data
      - /share/SERGEY/sql_log:/var/opt/mssql/log
      - /share/SERGEY/sql_secret:/var/opt/mssql/secrets
    environment:
      ACCEPT_EULA: Y
      SA_PASSWORD: Root1234
      MSSQL_PID: Express
      TZ: Asia/Bishkek
  hass:
    container_name: home-assistant
    image: ghcr.io/home-assistant/home-assistant:stable
    restart: unless-stopped
    privileged: true
    ports:
      - 8123:8123
    volumes:
      - /share/SERGEY/ha:/config
    environment:
      TZ: Asia/Bishkek
  pdfreactor:
   container_name: pdfreactor
   ports:
    - "9423:9423"
   image: "realobjects/pdfreactor"
   environment:
     JAVA_OPTIONS: "-Xmx2g -Dcom.realobjects.pdfreactor.webservice.threadPoolSize=4"

docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=<YourStrong!Passw0rd>' -p 1433:1433 -v /data:/var/opt/mssql/data -v /log:/var/opt/mssql/log -v /secrets:/var/opt/mssql/secrets -d mcr.microsoft.com/mssql/server:2019-latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment