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

slim build results in /usr/sbin/apache2ctl mkdir, mktemp and chmod: not found #663

Open
rjbathgate opened this issue Apr 10, 2024 · 4 comments

Comments

@rjbathgate
Copy link

rjbathgate commented Apr 10, 2024

Expected Behavior

docker compose up to start the container successfully


Actual Behavior

When using a slim image, docker compose up results in a failed container start, with errors:

image_name  | /usr/sbin/apache2ctl: 147: mkdir: not found
image_name  | /usr/sbin/apache2ctl: 126: mktemp: not found
image_name  | /usr/sbin/apache2ctl: 127: chmod: not found

Steps to Reproduce the Problem

docker compose build creates an image (approx 1GB). On this, docker compose up` works as expected.

slim this image, using slim build image_name - this results in an image approx 90MB

However, running docker compose up using this .slim image results in the errors as per above.

The base docker image is php:8.1-apache

I haven't provided the contents of usr/sbin/apache2ctl as mkdir, mktemp and chmod are standard functions so unsure why they are not found in the slim image.

I thought perhaps $PATH is getting 'broken' during the slim build so tried:

slim build --include-path /usr/local/sbin image_name

but no difference.

I'm unsure as to what to change as part of the slim build to restore these basic functions!

EDIT/UPDATE:

  1. Ran whereis chmod in the working container, which returned /usr/bin/chmod
  2. So then re-ran slim build using lim build --include-path /usr/bin/chmod image_name
  3. Now the error on docker compose up is slightly different, suggesting it's found chmod, but still errors
image_name  | /usr/sbin/apache2ctl: 147: mkdir: not found
image_name  | /usr/sbin/apache2ctl: 126: mktemp: not found
image_name  | chmod: missing operand after '755'
image_name  | Try 'chmod --help' for more information.

Slim Version

slim version linux/amd64|Transformer|1.40.11|1b271555882eacdfb4e6598d6d0552e9b9b1449b|2024-02-02_01:36:22PM

@kcq
Copy link
Member

kcq commented Apr 10, 2024

is there a specific reason you are using docker compose? do you have special config params for your php app (e.g., a mounted volume or an environment variable) or do you have other containers your php app depends on?

need to investigate more...

in the meantime, you can try this to see if you have better results: https://github.com/mintoolkit/mint/releases/tag/1.41.1

@rjbathgate
Copy link
Author

rjbathgate commented Apr 10, 2024 via email

@rjbathgate
Copy link
Author

in the meantime, you can try this to see if you have better results: https://github.com/mintoolkit/mint/releases/tag/1.41.1

Tried mint, with exactly the same outcome :-(

@kcq
Copy link
Member

kcq commented Apr 10, 2024

Generally if the container has parameters in the compose service definition those parameters need to be provided in the build call. Alternatively, you can point at the compose file you have and the service definition in it (using the --compose-file and --target-compose-svc flags), so the build command can pick up the parameters from it. Not saying this will resolve the root cause of the current failure, but it might help :)

Is there more you can share about the image you have? The php base image info is a good start. What kind of app do you have in the image? Is it a server app? Does it expose a port? How do your entrypoint and/or cmd instructions look like? Do you have a wrapper script to start your app? What does it do?

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

No branches or pull requests

2 participants