Hey all,
I have been trying to get Monica to run on my Ubuntu 17.04 Server ever since I have heard of it but I kept running into issues and my latest issue would be getting stuck at Step 13 of the docker-compose build, I have attached a photo of the error and I was hoping I could get some help with resolving it or if anyone else is facing the same issue.

I am encountering the same error with docker-compose build on 071dc4e58584b3424f2d1720c1acbd5bb6c226dc running macOS 10.12.4 (16E195).
$ docker --version
Docker version 17.03.1-ce, build c6d412e
$ docker-compose --version
docker-compose version 1.11.2, build dfed245
$ docker-machine --version
docker-machine version 0.10.0, build 76ed2a6
thill@tmba ~/projects/.../monica $ docker-compose build
mysql uses an image, skipping
Building monicahq
Step 1/16 : FROM alpine:3.6
---> a41a7446062d
Step 2/16 : EXPOSE 80:80
---> Using cache
---> 5331e79b5de2
Step 3/16 : RUN apk update && apk add apache2 curl git make netcat-openbsd nodejs-current-npm openssl php7 php7-apache2 php7-ctype php7-dom php7-fileinfo php7-gd php7-iconv php7-intl php7-json php7-mbstring php7-mysqli php7-openssl php7-pdo_mysql php7-phar php7-session php7-tokenizer php7-xml php7-xmlwriter php7-zip php7-zlib
---> Using cache
---> 64d98c5c234a
Step 4/16 : RUN npm install -g bower
---> Using cache
---> 67c98676efc4
Step 5/16 : RUN mkdir -p /run/apache2
---> Using cache
---> f9f89d4c0f21
Step 6/16 : RUN adduser -D monica && addgroup apache monica
---> Using cache
---> d08513cb1b26
Step 7/16 : WORKDIR /var/www/monica
---> Using cache
---> 3c2091d32770
Step 8/16 : ADD package.json .
---> Using cache
---> 26c014cee656
Step 9/16 : RUN chown -R monica . && su monica -c "npm install"
---> Using cache
---> 60dccd54407b
Step 10/16 : ADD . .
---> Using cache
---> 399816c5e002
Step 11/16 : RUN cp docker/000-default.conf /etc/apache2/conf.d && chown -R monica:monica . && chmod -R g+w bootstrap/cache storage
---> Using cache
---> 004babcf5499
Step 12/16 : USER monica
---> Using cache
---> 1c6850dc1260
Step 13/16 : RUN docker/install-composer.sh && ./composer.phar install
---> Running in 88f827ddfc2d
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for sabre/xml 2.0.0 -> satisfiable by sabre/xml[2.0.0].
- sabre/xml 2.0.0 requires ext-xmlreader * -> the requested PHP extension xmlreader is missing from your system.
Problem 2
- sabre/xml 2.0.0 requires ext-xmlreader * -> the requested PHP extension xmlreader is missing from your system.
- sabre/vobject 4.1.2 requires sabre/xml >=1.5 <3.0 -> satisfiable by sabre/xml[2.0.0].
- Installation request for sabre/vobject 4.1.2 -> satisfiable by sabre/vobject[4.1.2].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php7/php.ini
- /etc/php7/conf.d/00_ctype.ini
- /etc/php7/conf.d/00_dom.ini
- /etc/php7/conf.d/00_fileinfo.ini
- /etc/php7/conf.d/00_gd.ini
- /etc/php7/conf.d/00_iconv.ini
- /etc/php7/conf.d/00_intl.ini
- /etc/php7/conf.d/00_json.ini
- /etc/php7/conf.d/00_mbstring.ini
- /etc/php7/conf.d/00_openssl.ini
- /etc/php7/conf.d/00_pdo.ini
- /etc/php7/conf.d/00_session.ini
- /etc/php7/conf.d/00_tokenizer.ini
- /etc/php7/conf.d/00_xml.ini
- /etc/php7/conf.d/00_xmlwriter.ini
- /etc/php7/conf.d/00_zip.ini
- /etc/php7/conf.d/00_zlib.ini
- /etc/php7/conf.d/01_mysqlnd.ini
- /etc/php7/conf.d/01_phar.ini
- /etc/php7/conf.d/02_mysqli.ini
- /etc/php7/conf.d/02_pdo_mysql.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
ERROR: Service 'monicahq' failed to build: The command '/bin/sh -c docker/install-composer.sh && ./composer.phar install' returned a non-zero code: 2
Composer fails to detect installed xmlwriter, a workaround is to change the Dockerfile:
Replace line:
RUN docker/install-composer.sh && ./composer.phar install
with:
RUN docker/install-composer.sh && ./composer.phar install --ignore-platform-reqs
and rebuild.
Thank you @stone, that workaround worked.
What is the real fix for this?
Now running docker-compose up fails:
$ docker-compose up
Creating network "monica_default" with the default driver
Pulling mysql (mysql:latest)...
latest: Pulling from library/mysql
10a267c67f42: Pull complete
c2dcc7bb2a88: Pull complete
17e7a0445698: Pull complete
9a61839a176f: Pull complete
a1033d2f1825: Pull complete
0d6792140dcc: Pull complete
cd3adf03d6e6: Pull complete
d79d216fd92b: Pull complete
b3c25bdeb4f4: Pull complete
02556e8f331f: Pull complete
4bed508a9e77: Pull complete
Digest: sha256:2f4b1900c0ee53f344564db8d85733bd8d70b0a78cd00e6d92dc107224fc84a5
Status: Downloaded newer image for mysql:latest
Creating monica_mysql_1
Creating monica_monicahq_1
ERROR: for monicahq Cannot start service monicahq: driver failed programming external connectivity on endpoint monica_monicahq_1 (3dc177fa0e269eabccfdda24356e27926f9092835b0595bc6cafde98ddf6d8a7): Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error (Failure EADDRINUSE)
ERROR: Encountered errors while bringing up the project.
Should I change EXPOSE 80:80 and if so what to?
@Phrohdoh you probably have something that already is listening on port 80 on your host, if you change the EXPOSE 80:80 to EXPOSE 81:80 you can access monica with http://[host]:81/.
I still get Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error (Failure EADDRINUSE) with EXPOSE 81:80.
In fact no matter what I use I get that error.
I tried changing the first 80 to 81, 5656 (random number), 99999 and the same for the second but no dice.
@kstrauser do you see what the error could be?
I'm sorry to be of any help here, I'm a total noob concerning Docker.
I managed to kill all the processing running on port 80 and after re-running it I am stuck with "Unable to Connect to MySQL: sleeping"



@Phrohdoh #262 fixes the root cause of the build problem. Unfortunately I'm heading to work and can't look at the other problems right now. Things that may help, in order of aggressiveness:
docker-compose down to kill all docker-compose containers.docker kill $(docker ps -q) to really kill them.docker rm -f $(docker ps -a -q) to delete all containers so that you're not accidentally restarting one that's wedged.Let us know if that works, would you?
When trying to build the Docker image on commit b3f01a1fcfe40ec22c9ec8b85ed16b083a4a90dc, it fails in a similar way.
# docker build -t monicahq/monicahq . 1 ↵
Sending build context to Docker daemon 17.79 MB
Step 1 : FROM alpine:3.6
---> a41a7446062d
Step 2 : EXPOSE 80:80
---> Using cache
---> af45b12df20f
Step 3 : RUN apk update && apk add apache2 curl git make netcat-openbsd nodejs-current-npm openssl php7 php7-apache2 php7-ctype php7-dom php7-fileinfo php7-gd php7-iconv php7-intl php7-json php7-mbstring php7-mysqli php7-openssl php7-pdo_mysql php7-phar php7-session php7-tokenizer php7-xml php7-xmlreader php7-xmlwriter php7-zip php7-zlib php7-pgsql
---> Running in 40cd6aadebfd
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
v3.6.1-11-gd41da612f8 [http://dl-cdn.alpinelinux.org/alpine/v3.6/main]
v3.6.1-9-ge60cdc58fd [http://dl-cdn.alpinelinux.org/alpine/v3.6/community]
OK: 8430 distinct packages available
(1/73) Installing libuuid (2.28.2-r2)
(2/73) Installing apr (1.5.2-r1)
(3/73) Installing expat (2.2.0-r0)
(4/73) Installing apr-util (1.5.4-r3)
(5/73) Installing pcre (8.40-r2)
(6/73) Installing apache2 (2.4.25-r1)
Executing apache2-2.4.25-r1.pre-install
(7/73) Installing ca-certificates (20161130-r2)
(8/73) Installing libssh2 (1.8.0-r1)
(9/73) Installing libcurl (7.54.0-r0)
(10/73) Installing curl (7.54.0-r0)
(11/73) Installing git (2.13.0-r0)
(12/73) Installing make (4.2.1-r0)
(13/73) Installing libbsd (0.8.3-r3)
(14/73) Installing netcat-openbsd (1.130-r1)
(15/73) Installing libcrypto1.0 (1.0.2k-r0)
(16/73) Installing libgcc (6.3.0-r4)
(17/73) Installing http-parser (2.7.1-r1)
(18/73) Installing libssl1.0 (1.0.2k-r0)
(19/73) Installing libstdc++ (6.3.0-r4)
(20/73) Installing libuv (1.11.0-r1)
(21/73) Installing nodejs-current (7.10.0-r0)
(22/73) Installing nodejs-current-npm (7.10.0-r0)
(23/73) Installing openssl (1.0.2k-r0)
(24/73) Installing php7-common (7.1.5-r0)
(25/73) Installing ncurses-terminfo-base (6.0-r7)
(26/73) Installing ncurses-terminfo (6.0-r7)
(27/73) Installing ncurses-libs (6.0-r7)
(28/73) Installing libedit (20170329.3.1-r2)
(29/73) Installing libxml2 (2.9.4-r3)
(30/73) Installing php7 (7.1.5-r0)
(31/73) Installing php7-apache2 (7.1.5-r0)
(32/73) Installing php7-ctype (7.1.5-r0)
(33/73) Installing php7-dom (7.1.5-r0)
(34/73) Installing php7-fileinfo (7.1.5-r0)
(35/73) Installing libxau (1.0.8-r1)
(36/73) Installing libxdmcp (1.1.2-r3)
(37/73) Installing libxcb (1.12-r0)
(38/73) Installing libx11 (1.6.5-r0)
(39/73) Installing libxext (1.3.3-r1)
(40/73) Installing libice (1.0.9-r1)
(41/73) Installing libsm (1.2.2-r0)
(42/73) Installing libxt (1.1.5-r0)
(43/73) Installing libxpm (3.5.12-r0)
(44/73) Installing libbz2 (1.0.6-r5)
(45/73) Installing libpng (1.6.29-r1)
(46/73) Installing freetype (2.7.1-r1)
(47/73) Installing libjpeg-turbo (1.5.1-r0)
(48/73) Installing libwebp (0.6.0-r0)
(49/73) Installing php7-gd (7.1.5-r0)
(50/73) Installing php7-iconv (7.1.5-r0)
(51/73) Installing icu-libs (58.2-r2)
(52/73) Installing php7-intl (7.1.5-r0)
(53/73) Installing php7-json (7.1.5-r0)
(54/73) Installing php7-mbstring (7.1.5-r0)
(55/73) Installing php7-openssl (7.1.5-r0)
(56/73) Installing php7-mysqlnd (7.1.5-r0)
(57/73) Installing php7-mysqli (7.1.5-r0)
(58/73) Installing php7-pdo (7.1.5-r0)
(59/73) Installing php7-pdo_mysql (7.1.5-r0)
(60/73) Installing db (5.3.28-r0)
(61/73) Installing libsasl (2.1.26-r10)
(62/73) Installing libldap (2.4.44-r5)
(63/73) Installing libpq (9.6.3-r0)
(64/73) Installing php7-pgsql (7.1.5-r0)
(65/73) Installing php7-phar (7.1.5-r0)
(66/73) Installing php7-session (7.1.5-r0)
(67/73) Installing php7-tokenizer (7.1.5-r0)
(68/73) Installing php7-xml (7.1.5-r0)
(69/73) Installing php7-xmlreader (7.1.5-r0)
(70/73) Installing php7-xmlwriter (7.1.5-r0)
(71/73) Installing libzip (1.2.0-r1)
(72/73) Installing php7-zip (7.1.5-r0)
(73/73) Installing php7-zlib (7.1.5-r0)
Executing busybox-1.26.2-r4.trigger
Executing ca-certificates-20161130-r2.trigger
OK: 132 MiB in 84 packages
---> 561bee362c07
Removing intermediate container 40cd6aadebfd
Step 4 : RUN npm install -g bower
---> Running in 90d9b0ac0090
npm WARN deprecated [email protected]: ..psst! While Bower is maintained, we recommend Yarn and Webpack for *new* front-end projects! Yarn's advantage is security and reliability, and Webpack's is support for both CommonJS and AMD projects. Currently there's no migration path but we hope you'll help us figure out one.
/usr/bin/bower -> /usr/lib/node_modules/bower/bin/bower
/usr/lib
`-- [email protected]
---> b670ed52fa44
Removing intermediate container 90d9b0ac0090
Step 5 : RUN mkdir -p /run/apache2
---> Running in 0e5c10f53739
---> c89a17807c30
Removing intermediate container 0e5c10f53739
Step 6 : RUN adduser -D monica && addgroup apache monica
---> Running in f410c741a2ab
---> 8e4bf738182a
Removing intermediate container f410c741a2ab
Step 7 : WORKDIR /var/www/monica
---> Running in c3e1c1fa11fd
---> ab2d635e65ed
Removing intermediate container c3e1c1fa11fd
Step 8 : ADD package.json .
---> 2ff3613c3560
Removing intermediate container 75315e0cac7e
Step 9 : RUN chown -R monica . && su monica -c "npm install"
---> Running in e2abe8cb3317
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN prefer global [email protected] should be installed with -g
npm WARN prefer global [email protected] should be installed with -g
> [email protected] install /var/www/monica/node_modules/node-sass
> node scripts/install.js
The command '/bin/sh -c chown -R monica . && su monica -c "npm install"' returned a non-zero code: 1
@kstrauser No dice I get the same error.
Deleting the folder and making sure that Docker service killed the process and restarted I was able to build successfully but trying to run docker-compose up gives off a "unable to connect to MySQL; Sleeping'
@supergillis, @Phrohdoh I'm not sure about the build problems as that seems to be with the code itself and not the Docker environment (from what I can tell). Could @djaiss take a peek at it?
@djaiss Is there anything you suggest I do here? I can't contribute to the larger tickets the way I'd like to without this being resolved.
Ok I was able to get past that error by killing the apache service.
$ sudo /usr/sbin/apachectl stop
@Phrohdoh do you have any suggestions for the MySQL error that I am currently facing? Since I opt-in to using the pre-built docker method would the MySQL be another container that has the setting configured by docker?
@AbdullaBuali Would you share the entire output, please?
I get that message as well but just seconds later it moves on to more mysql log messages.
$ docker-compose up
Starting monica_mysql_1
Recreating monica_monicahq_1
Attaching to monica_mysql_1, monica_monicahq_1
mysql_1 | 2017-06-14T22:18:28.501484Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
mysql_1 | 2017-06-14T22:18:28.515857Z 0 [Note] mysqld (mysqld 5.7.18) starting as process 1 ...
mysql_1 | 2017-06-14T22:18:28.523207Z 0 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
mysql_1 | 2017-06-14T22:18:28.525562Z 0 [Note] InnoDB: PUNCH HOLE support available
mysql_1 | 2017-06-14T22:18:28.525592Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mysql_1 | 2017-06-14T22:18:28.525599Z 0 [Note] InnoDB: Uses event mutexes
mysql_1 | 2017-06-14T22:18:28.525606Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
mysql_1 | 2017-06-14T22:18:28.525613Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
mysql_1 | 2017-06-14T22:18:28.525619Z 0 [Note] InnoDB: Using Linux native AIO
mysql_1 | 2017-06-14T22:18:28.525923Z 0 [Note] InnoDB: Number of pools: 1
mysql_1 | 2017-06-14T22:18:28.526030Z 0 [Note] InnoDB: Using CPU crc32 instructions
mysql_1 | 2017-06-14T22:18:28.536026Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
mysql_1 | 2017-06-14T22:18:28.553291Z 0 [Note] InnoDB: Completed initialization of buffer pool
mysql_1 | 2017-06-14T22:18:28.556939Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
monicahq_1 | docker/waitfordb.sh
monicahq_1 | Connecting to mysql
monicahq_1 | Unable to connect to MySQL; sleeping
mysql_1 | 2017-06-14T22:18:28.623718Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
mysql_1 | 2017-06-14T22:18:28.656423Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 12140417
...
@Phrohdoh Here is the output, I left it running for a while and that is the only message I would get, it would not move on

Perhaps MySQL isn't listening on 3306.
I suggest a read through https://github.com/docker/compose/issues/374 then let us know if anything there helps.
https://serverfault.com/questions/260239/unable-to-connect-to-mysql-through-port-3306#519926 may be of help too.
I had the same issue being unable to connect to mysql with the prebuilt image. I got it to work by changing DB_HOST in the .env file to DB_HOST=mysql_1
The default value in .evn.example which I created it from is DB_HOST=127.0.0.1
Has this been solved?
You need to set DB_HOST=mysql in .env file.
By default this option is set to 127.0.0.1. But when starting Monica using docker-compose MySQL isn't running at localhost; it runs in a seperate container with it's own ip address. Therefor the value of DB_HOST must point to this cointainer.
I think this is resolved
Most helpful comment
@Phrohdoh you probably have something that already is listening on port 80 on your host, if you change the EXPOSE 80:80 to EXPOSE 81:80 you can access monica with http://[host]:81/.