Skip to content

Instantly share code, notes, and snippets.

@ronoaldo
Created May 31, 2022 20:19
Show Gist options
  • Save ronoaldo/b3d37fd19fdea52cc9bf25953fae71aa to your computer and use it in GitHub Desktop.
Save ronoaldo/b3d37fd19fdea52cc9bf25953fae71aa to your computer and use it in GitHub Desktop.
MariaDB com acesso externo
service mariadb start
sleep 2
echo "create user external@'%' identified by 'external';" | mysql -u root -p123456
sleep 2
service mariadb stop
FROM debian:bullseye
# Install do server
ENV DEBIAN_FRONTEND=noninteractive
RUN echo "mariadb-server mysql-server/root_password password 123456" | debconf-set-selections
RUN echo "mariadb-server mysql-server/root_password_again password 123456" | debconf-set-selections
RUN apt-get update && apt-get install mariadb-server -yq
# Configuração do acesso externo ao container
RUN sed -e 's/bind-address.*/bind-address = 0.0.0.0/g' -i /etc/mysql/mariadb.conf.d/50-server.cnf
COPY create-user.sh /tmp/create-user.sh
RUN bash /tmp/create-user.sh
# Roda o server para testes
CMD ["bash", "-c", "service mariadb start && tail -f /var/log/mysql/*.log /var/log/dpkg.log"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment