Skip to content

Instantly share code, notes, and snippets.

@WyekS
Last active April 27, 2021 13:17
Show Gist options
  • Save WyekS/4869631116c9fef7ce192cc6ab1f1706 to your computer and use it in GitHub Desktop.
Save WyekS/4869631116c9fef7ce192cc6ab1f1706 to your computer and use it in GitHub Desktop.
Script para lanzar un contenedor de Docker con MySQL con la configuración óptima para su uso en un desarrollo local. Personalizar las variables para su correcto funcionamiento.
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=hybris
MYSQL_USER=hybris
MYSQL_PASSWORD=hybris
DOCKER_CONTAINER=name_project_container
DOCKER_VOL_CONFIG=$HOME/project/$DOCKER_CONTAINER/etc/mysql/conf.d
DOCKER_VOL_DATA=$HOME/project/$DOCKER_CONTAINER/var/lib/mysql
docker run --rm --name $DOCKER_CONTAINER \
-v $DOCKER_VOL_CONFIG:/etc/mysql/conf.d \
-v $DOCKER_VOL_DATA:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD \
-e MYSQL_DATABASE=$MYSQL_DATABASE \
-e MYSQL_USER=$MYSQL_USER \
-e MYSQL_PASSWORD=$MYSQL_PASSWORD \
-p 3306:3306 \
-d mysql:5.7 \
--character-set-server=utf8 \
--collation-server=utf8_general_ci \
--innodb-flush-log-at-trx-commit=0 \
--transaction-isolation=READ-COMMITTED \
--innodb-flush-method=O_DIRECT \
--innodb-buffer-pool-size=2G \
--innodb-log-file-size=256M \
--skip-log-bin \
--skip-ssl \
--max-allowed-packet=1GB \
--wait-timeout=43200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment