timegridio / dockerfiles

Timegrid Dockerfile for containerized local development environment
6 stars 8 forks source link

Fails to build #7

Open marcbria opened 5 years ago

marcbria commented 5 years ago

Dockerfile fails to install mysql-server:

Step 7/20 : RUN echo 'mysql-server mysql-server/root_password password r00t' | debconf-set-selections &&     echo 'mysql-server mysql-server/root_password_again password r00t'| debconf-set-selections &&     apt-get install mysql-server -y &&     /etc/init.d/mysql stop
 ---> Running in fc2275e3ec08
Reading package lists...
Building dependency tree...
Reading state information...
Package mysql-server is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'mysql-server' has no installation candidate
The command '/bin/sh -c echo 'mysql-server mysql-server/root_password password r00t' | debconf-set-selections &&     echo 'mysql-server mysql-server/root_password_again password r00t'| debconf-set-selections &&     apt-get install mysql-server -y &&     /etc/init.d/mysql stop' returned a non-zero code: 100

BTW, why not including the project in dockerhub? Are you planning to release a docker-compose?

Thanks for your work, m.

PeGa commented 5 years ago

Hi @marcbria, at the time this Dockerfile was created, probably Debian Jessie was "latest". Considering that Debian Buster (current "latest") introduced a lot of breaking changes, I'd suggest you to try with FROM debian:jessie.

We might include a docker-compose.yml file altogether with a brand new Dockerfile some time in the future. However, it's unclear for us if it will be in the docker hub.

Regards.

manfredsteger commented 4 years ago

hi @PeGa tried with FROM debian:jessie

but there is an error at starting mysqld:

Starting MySQL database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed! The command '/bin/sh -c apt-get install php5 php5-mysql git wget curl php5-curl php5-intl phpunit vim -y && /etc/init.d/mysql start && echo "CREATE DATABASE timegrid_dev CHARACTER SET utf8 COLLATE utf8_general_ci; GRANT ALL ON timegrid_dev.* TO 'timegrid_dev'@localhost IDENTIFIED BY 'tgpass';" | mysql -pr00t && echo "CREATE DATABASE testing_timegrid CHARACTER SET utf8 COLLATE utf8_general_ci; GRANT ALL ON testing_timegrid.* TO 'testing_timegrid'@localhost IDENTIFIED BY 'testing_timegrid';" | mysql -pr00t && /etc/init.d/mysql stop' returned a non-zero code: 1

Can you help? Ty very much.

Image on hub.docker would be great :D

minhtt159 commented 4 years ago
Seeded: NotifynderCategoriesSeeder
Seeded the Notifynder Categories!
Seeded: CategoriesSeeder
Seeded the Param Categories!
Seeded: CountriesSeeder
Seeded the Param Countries!
Seeded: RolesTableSeeder
Seeded the Param Roles!
Updating...

  [ErrorException]
  get_headers(): php_network_getaddresses: getaddrinfo failed: Name or service not known

The command '/bin/sh -c /etc/init.d/mysql start &&     php artisan migrate --seed --database=testing &&     php artisan key:generate &&     php artisan migrate &&     php artisan db:seed &&     php artisan geoip:update &&     /etc/init.d/mysql stop' returned a non-zero code: 1

I edited debian:latest -> debian:jessie and having this problem. Maybe php in docker requires some thing more?

minhtt159 commented 4 years ago

This is not the answer for your question, but I can manage to have the service start and running.

  1. Pull this dockerfile from the repo
  2. Comment out these line
    
    RUN /etc/init.d/mysql start && \
    php artisan migrate --seed --database=testing && \
    php artisan key:generate && \
    php artisan migrate && \
    php artisan db:seed && \
    php artisan geoip:update && \
    /etc/init.d/mysql stop

CMD /etc/init.d/mysql start && tail -f /dev/null

3. Build docker image: 

outside docker $> sudo docker build -t timegrid --build-arg user=$(whoami) --build-arg uid=$(id -u) .

4. Run docker image with -it:

outside docker $> sudo docker run -it -p 8000:8000 timegrid:latest /bin/bash

5. Finish what you have commented out:

inside docker $> /etc/init.d/mysql start && php artisan migrate --seed --database=testing && php artisan key:generate && php artisan migrate && php artisan db:seed && php artisan serve --host 0.0.0.0


6. Profit
Frozen-byte commented 4 years ago

@minhtt159 Your guide is nice, thank you.

I pinned the issue further down to the php artisan geoip:update && \ line. Yet I have no clue why it fails. Any Suggestions?

minhtt159 commented 4 years ago

@minhtt159 Your guide is nice, thank you.

I pinned the issue further down to the php artisan geoip:update && \ line. Yet I have no clue why it fails. Any Suggestions?

I believe that mysql server must run "all the time", also "in a different container". You can not start mysql server in the docker image. It doesn't work like that. You can design a mechanism that when docker container is starting, run the script that start mysql server and create database.