Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docker compose on MacOS #570

Merged
merged 4 commits into from
Jul 2, 2024
Merged

Fix docker compose on MacOS #570

merged 4 commits into from
Jul 2, 2024

Conversation

fzaninotto
Copy link
Contributor

Problem

When calling docker compose up, the pwa service fails with a strange error on MacOS:

pwa-1       | yarn run v1.22.22
pwa-1       | $ storybook dev -p 3000
pwa-1       | /bin/sh: 1: storybook: not found
pwa-1       | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
pwa-1       | error Command failed with exit code 127.

It seems the container doesn't find the node_modules at all.

Solution

Add a second volume for the node_modules.

Q A
Branch? main for features / current stable version branch for bug fixes
Tickets Closes #..., closes #...
License MIT
Doc PR api-platform/docs#...

## Problem

When calling `docker compose up`, the `pwa` service fails with a strange error on MacOS:

```
pwa-1       | yarn run v1.22.22
pwa-1       | $ storybook dev -p 3000
pwa-1       | /bin/sh: 1: storybook: not found
pwa-1       | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
pwa-1       | error Command failed with exit code 127.
```

It seems the container doesn't find the node_modules at all.

## Solution

Add a second volume for the node_modules.

# copy sources
COPY --link . ./

RUN set -eux; \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change is unrelated, but it speeds up the builds and reduces the number of layers to store.

@fzaninotto
Copy link
Contributor Author

It seems my change makes the build fail on Linux for another developer:

Creating volume "api-platform-admin_pwa_node_modules" with default driver
api-platform-admin_database_1 is up-to-date
Recreating api-platform-admin_pwa_1 ... 
Starting 26287da17ab2_api-platform-admin_php_1 ... done

ERROR: for api-platform-admin_pwa_1  'ContainerConfig'

ERROR: for pwa  'ContainerConfig'
Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose/cli/main.py", line 81, in main
  File "compose/cli/main.py", line 203, in perform_command
  File "compose/metrics/decorator.py", line 18, in wrapper
  File "compose/cli/main.py", line 1186, in up
  File "compose/cli/main.py", line 1182, in up
  File "compose/project.py", line 702, in up
  File "compose/parallel.py", line 108, in parallel_execute
  File "compose/parallel.py", line 206, in producer
  File "compose/project.py", line 688, in do
  File "compose/service.py", line 581, in execute_convergence_plan
  File "compose/service.py", line 503, in _execute_convergence_recreate
  File "compose/parallel.py", line 108, in parallel_execute
  File "compose/parallel.py", line 206, in producer
  File "compose/service.py", line 496, in recreate
  File "compose/service.py", line 615, in recreate_container
  File "compose/service.py", line 334, in create_container
  File "compose/service.py", line 922, in _get_container_create_options
  File "compose/service.py", line 962, in _build_container_volume_options
  File "compose/service.py", line 1549, in merge_volume_bindings
  File "compose/service.py", line 1579, in get_container_data_volumes
KeyError: 'ContainerConfig'
[1712682] Failed to execute script docker-compose

Docker is NOT portable at all...

I'm currently investigating.

@djhi djhi merged commit 56efa7c into main Jul 2, 2024
4 checks passed
@djhi djhi deleted the fix-docker-compose-macos branch July 2, 2024 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants