Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FROM ubuntu
- LABEL maintainer="author@mail.ru"
- ENV ADMIN="admin"
- RUN apt update && apt install mysql-server mysql-client -y
- RUN cp -r -p /var/lib/mysql /var/init_data
- COPY ./app ./app
- CMD /app/startup.sh
- CMD service mysql start
- WORKDIR /home
- startup.sh:
- #!/bin/bash
- if [ ! -f /var/lib/mysql/ibdata1 ]; then
- echo "data initialize..."
- cp -r -p /var/init_data/* /var/lib/mysql
- else
- echo "data has restored from volume"
- fi
- # run:
- docker run -it --name mysql -p 3306:3306 -v /home/docker/mysql:/var/lib/mysql mysql bash
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement