I'm having problems with Docker.
I am using Docker
and docker-compose
to create and configure a web environment quickly and practically.
I've been a docker user for some time, but I've never had to upload a large file to a bunch of data.
I am using Mysql 5.5
for compatibility in some of my projects.
I did some research and found that I could upload a .sh file from the host to the mysql container and execute whatever I wanted, but I always get the following error:
mysql: unrecognized service
My file Dockerfile
FROM php:5.6-apache
RUN docker-php-ext-install mysqli
RUN a2enmod rewrite
COPY setup.sh /mysql/setup.sh
COPY setup.sql /mysql/setup.sql
RUN /mysql/setup.sh
My file docker-compose.yml
php:
build: .
ports:
- "80:80"
- "443:443"
volumes:
- ./www:/var/www/html
links:
- mysql
mysql:
image: mysql:5.5
volumes:
- /var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=1234
- MYSQL_DATABASE=my_db
This is my file setup.sh
#!/bin/bash
set -e
service mysql start
mysql uroot -p1234 my_db < /mysql/setup.sql
service mysql stop
All goes well, the error happens in the setup.sh line: service mysql start
Thank you in advance.