wp-local-docker-v2 icon indicating copy to clipboard operation
wp-local-docker-v2 copied to clipboard

Docker containers fail to start due to docker-compose.yml error

Open jasonskinner opened this issue 4 years ago • 12 comments

Describe the bug Installed wp-local-docker v3.0.0 in WSL. When trying to create or start a project, it fails in starting the docker containers with the following error in docker-compose.yml:

Error : yaml.constructor.ConstructorError: could not determine a constructor for the tag 'tag:yaml.org,2002:js/undefined' in "./docker-compose.yml", line 48, column 20

Steps to Reproduce

  1. 10updocker create
  2. Go through setup
  3. Error is produced when starting containers

Expected behavior The expectation is that the site would be created or that the site would start

Screenshots

InkedScreenshot 2021-11-16 202058

Environment information

  • Device: PC Desktop
  • OS: Windows 11
  • Docker Desktop version: 4.1.1
  • Browser and version: N/A
  • WordPress version: N/A (not installed yet, but would be latest from WP git repo)
  • nvm: 1.1.7
  • npm: 8.1.3

Additional context This is a freshly installed version of wp-local-docker.

Also, thanks for making this! It's appreciated. I've been using wp-local-docker since the initial version.

jasonskinner avatar Nov 17 '21 02:11 jasonskinner

hey y'all,

Can you run 10updocker configure and 10updocker image update and see if this resolves the issue for you?

Thanks!

tylercherpak avatar Nov 17 '21 13:11 tylercherpak

Configure and Update

10updocker configure

? What directory would you like WP Local Docker to create environments within? /home/jason/wp-local-docker-sites ? What directory would you like to store WP Snapshots data within? /home/jason/.wpsnapshots ? Would you like WP Local Docker to manage your hosts file? Yes ? Do you want to reset your global services configuration? This will reset any customizations you have made. Yes

10updocker image update

? Updating images requires all environments to be stopped. Is that okay? Yes ✔ Global services are stopped... ℹ jwilder/nginx-proxy:alpine doesn't exist on this system. Skipping update... ℹ mariadb:10.3 doesn't exist on this system. Skipping update... ✔ schickling/mailcatcher has been updated... ℹ phpmyadmin doesn't exist on this system. Skipping update... ℹ 10up/wp-php-fpm-dev:8.0-ubuntu doesn't exist on this system. Skipping update... ℹ 10up/wp-php-fpm-dev:7.4-ubuntu doesn't exist on this system. Skipping update... ℹ 10up/wp-php-fpm-dev:7.3-ubuntu doesn't exist on this system. Skipping update... ℹ 10up/wp-php-fpm-dev:7.2-ubuntu doesn't exist on this system. Skipping update... ℹ 10up/wp-php-fpm-dev:7.1-ubuntu doesn't exist on this system. Skipping update... ℹ 10up/wp-php-fpm-dev:7.0-ubuntu doesn't exist on this system. Skipping update... ℹ 10up/wp-php-fpm-dev:5.6-ubuntu doesn't exist on this system. Skipping update... ℹ 10up/wpsnapshots:2 doesn't exist on this system. Skipping update... ✔ memcached:latest has been updated... ✔ nginx:latest has been updated... ✔ docker.elastic.co/elasticsearch/elasticsearch:5.6.16 has been updated...

Result

Still producing the following error: Error : yaml.constructor.ConstructorError: could not determine a constructor for the tag 'tag:yaml.org,2002:js/undefined' in "./docker-compose.yml", line 48, column 20

jasonskinner avatar Nov 17 '21 21:11 jasonskinner

hey @jasonskinner

We pushed a fix for this. Please run npm i -g wp-local-docker@next to get the latest version with the fix included.

Let us know if you have questions or any issues! 😄

tylercherpak avatar Nov 17 '21 21:11 tylercherpak

Hi there! I'm happy to say this was happening to me on Linux Mint and using 3.0.1-rc.1 almost fixed the problem completely. I can create a new site using PHP 7.4 without any problems but when I try to use PHP 8.0 I get:

⠇ Starting docker containers for ep-365-test...
 Error : Creating network "ep-365-test_default" with the default driver
Creating volume "ep-365-test_elasticsearchData" with default driver
Building phpfpm
The command '/bin/bash -c chown ${CALLING_USER} /var/log/php-fpm' returned a non-zero code: 1
Service 'phpfpm' failed to build : Build failed

Thanks!

felipeelia avatar Nov 18 '21 12:11 felipeelia

@tylercherpak

The next branch worked perfectly. I got further in the process. But when I try to start a container/site, I get the following:

jason@example:~$ 10updocker start docker.test ✔ Global services are running... ✔ MariaDB has started... ⠴ Starting docker containers for docker-test... Error : time="2021-11-18T20:03:00-06:00" level=warning msg="network wplocaldocker: network.external.name is deprecated in favor of network.name" time="2021-11-18T20:03:00-06:00" level=warning msg="volume wplocaldockerCache: volume.external.name is deprecated in favor of volume.name" phpfpm Pulling phpfpm Error failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/bash -c chown ${CALLING_USER} /var/log/php-fpm]: exit code: 1

jasonskinner avatar Nov 19 '21 02:11 jasonskinner

bumping this. Same error on a fresh install of Pop!_os on 10updocker version 3.0. tried the @next to get the latest release candidate and got the same error as @jasonskinner In the meantime started using version 2.8

azatecas avatar Nov 26 '21 18:11 azatecas

Running into the same issue as @felipeelia Can't make php8 work. Creating a php7.4 site, then manually updating the composer file to th php8 image still fails with the same error.

sodapopjunkie avatar Dec 08 '21 03:12 sodapopjunkie

This is all on a fresh install of 10updocker in WSL.

sodapopjunkie avatar Dec 08 '21 03:12 sodapopjunkie

In your site directory you will find a .containers/php-fpm file. Can you try replacing it with this?

ARG PHP_IMAGE=10up/wp-php-fpm-dev:8.0-ubuntu
FROM ${PHP_IMAGE}

ARG CALLING_USER=www-data
ARG CALLING_UID=33

LABEL "com.10up.wp-local-docker"="user-image"

USER root

RUN useradd ${CALLING_USER} -u ${CALLING_UID}
RUN mkdir -p /run/php-fpm
RUN chown ${CALLING_USER} /run/php-fpm
RUN chown ${CALLING_USER} /var/log/php*log
RUN touch /usr/local/etc/msmtprc && chown ${CALLING_USER} $_

USER ${CALLING_USER}

Then run docker-compose build and finally 10updocker start.

dustinrue avatar Dec 08 '21 04:12 dustinrue

I'm bringing this up as I had similar issues on WSL2 (Ubuntu). More specifically, while the Error : yaml.constructor.ConstructorError: is fixed by running npm i -g wp-local-docker@next to update to the latest version, I still can't create a new project with php 8.0, as I bump into the same error that @felipeelia mentioned earlier.

To have PHP 8.0, I had to do the following:

  1. create a project with 7.4
  2. Run docker pull 10up/wp-php-fpm:8.0-ubuntu to pull the PHP image, as it didn't exist on my system
  3. Manually update docker-compose.yml to use 8.0 instead of 7.4

But then, another issue came up, as while the site was loading fine, I couldn't install or remove a plugin, neither from the admin or using wp-cli, as there seemed to be permission errors on both cases. In fact, I couldn't run wp-cli commands at all because I didn't have write permissions (I didn't keep a note of the exact message).

Eventually, I modified the .containers/php-fpm file following the instructions from @dustinrue's post and that issue was fixed too.

Now everything seems to work fine, though if I want to have a PHP 8.0 installation, I'd have to take the steps that I mentioned.

gsarig avatar Dec 18 '21 22:12 gsarig

Thanks @gsarig we are currently working on a more permanent solution. I will update when I have more info.

tylercherpak avatar Dec 20 '21 18:12 tylercherpak

related pr: #268

tylercherpak avatar Dec 22 '21 14:12 tylercherpak