slimtoolkit / slimtoolkit/slim

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

Open
#663 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
23.4k
Forks
840
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the php:8.1-apache image by comparing a normal docker compose build with the result of slim build. Start from the apache2ctl errors and Slim's handling of the referenced commands, including /usr/bin/chmod; done means docker compose up starts the slim image without mkdir, mktemp, or chmod errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
apache, docker, docker-compose, php
Domain
devops, infrastructure, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.