Created
November 19, 2023 11:06
-
-
Save lmorillas/22756379506fc55e01b3bfbcd72679e6 to your computer and use it in GitHub Desktop.
Test Vagrant Mysql
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "bento/ubuntu-22.04" | |
# puertos host y máquina virtualizada | |
#config.vm.network :forwarded_port, host: 8080, guest: 80 | |
# config.vm.synced_folder './', '/vagrant', SharedFoldersEnableSymlinksCreate: false | |
# require plugin https://github.com/leighmcculloch/vagrant-docker-compose | |
config.vagrant.plugins = "vagrant-docker-compose" | |
# copiamos la carpeta de los estáticos dentro de la máquina. | |
# Para usar rsync, tiene que estar instalado en el host | |
# https://learn.microsoft.com/en-us/windows/wsl/install | |
# install docker and docker-compose | |
config.vm.provision :docker | |
config.vm.provision :docker_compose | |
config.vm.provision "shell", inline: <<-SHELL | |
sudo docker run -d \ | |
--name mysql-container \ | |
-e MYSQL_ROOT_PASSWORD=root_password \ | |
-e MYSQL_DATABASE=mydb \ | |
-e MYSQL_USER=user \ | |
-e MYSQL_PASSWORD=user_password \ | |
-p 3306:3306 \ | |
mysql:latest | |
# Wait for MySQL to start | |
SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
me pide contraseña pero no se