linkstack-docker icon indicating copy to clipboard operation
linkstack-docker copied to clipboard

Docker unable to start - sed: can't create temp file

Open tilllt opened this issue 8 months ago • 10 comments

Following the install instructions for docker-compose, the container cannot be started, the error message is:

linkstack-1  | + ------------------------------------------------------------------ +
linkstack-1  | |                      LINKSTACK v4.2.3                      |
linkstack-1  | + ------------------------------------------------------------------ +
linkstack-1  | | Updating Configuration: Apache Base (/etc/apache2/httpd.conf)      |
linkstack-1  | sed: can't create temp file '/etc/apache2/httpd.confXXXXXX': Permission denied

tilllt avatar May 05 '25 10:05 tilllt

can you share your docker compose file ?

lastsamurai26 avatar May 05 '25 10:05 lastsamurai26

Cut & paste on my phone destroyed the indentation but the content is there.

services: linkstack: hostname: 'linkstack' container_name: linkstack image: 'linkstackorg/linkstack:latest' environment: TZ: 'Europe/Berlin' SERVER_ADMIN: '[email protected]' HTTP_SERVER_NAME: 'link.example.org' HTTPS_SERVER_NAME: 'link.example.org' LOG_LEVEL: 'info' PHP_MEMORY_LIMIT: '256M' UPLOAD_MAX_FILESIZE: '8M' volumes: - linkstack_data:/htdocs' # ports: # - '8080:80' # - '8081:443' restart: unless-stopped user: apache:apache # read_only: true depends_on: - mysql links: - mysql labels: - "traefik.enable=true" # Define the router - "traefik.http.routers.link.rule=Host(link.example.org)" - "traefik.http.routers.link.entrypoints=websecure" - "traefik.http.routers.link.tls.certresolver=myresolver"

  # Define the service
  - "traefik.http.services.link.loadbalancer.server.port=80

" # HTTP to HTTPS redirect - "traefik.http.middlewares.link-redirect.redirectscheme. scheme=https" - "traefik.http.routers.link-insecure.middlewares=link-re direct" - "traefik.http.routers.link-insecure.rule=Host(link.example.org)" - "traefik.http.routers.link-insecure.entrypoints=web" - "traefik.docker.network=traefik-proxy" networks: - traefik-proxy - default

mysql: image: mysql:8 environment: MYSQL_ROOT_PASSWORD: xxxyyyy ports: - 3306:3306 networks: - default restart: unless-stopped

networks: traefik-proxy: external: true

volumes: linkstack_data: driver: local driver_opts: o: bind type: none device: /opt/container/linkstack-docker/DATA/

tilllt avatar May 05 '25 13:05 tilllt

thx the problem is the detail :-)

you are using docker path instead of docker volume device: /opt/container/linkstack-docker/DATA/ <--

download the latest archiv of Linkstack and put it into the folder

chown -R 100:101 /opt/container/linkstack-docker/DATA/

lastsamurai26 avatar May 05 '25 13:05 lastsamurai26

download the latest archiv of Linkstack and put it into the folder\n\nchown -R 100:101 /opt/container/linkstack-docker/DATA/

Why do I have to download Linkstack, if I already pulled the container? Why is your Dockerfile not copying the files it needs to the persistent volumes?

tilllt avatar May 05 '25 13:05 tilllt

The problem is that we are currently working on a different solution. Docker volumes work without problems, but with a relative path it does not work.

Unfortunately, we have not been able to find a Docker expert.

lastsamurai26 avatar May 05 '25 13:05 lastsamurai26

Assuming that I am having the same issue, this had not been fixed or resolved yet?

deboy69 avatar Jul 23 '25 16:07 deboy69

not yet

lastsamurai26 avatar Jul 24 '25 15:07 lastsamurai26

I also noticed that defining USER: in the compose file also results in the same issue, even when using a volume. Thought I would pass that on.

Rumpick avatar Jul 29 '25 04:07 Rumpick

if I use a volume normally and no path then it works without problems. Unfortunately I cannot understand your error

lastsamurai26 avatar Jul 29 '25 05:07 lastsamurai26

This is what copilot has to say in regards to your dockerfile

After reviewing the Dockerfile, one likely reason people encounter problems with relative bind mounts is due to the WORKDIR instruction:

60| WORKDIR /htdocs

When you use a relative bind mount (for example, -v ./my-folder:/htdocs in docker run or your Compose file), Docker resolves ./my-folder relative to where you run the Docker command—not relative to anything inside the container. However, inside the container, /htdocs is an absolute path set as the working directory.

Common issues with relative bind mounts in this context include:

  • If the relative path on your host (e.g., ./my-folder) does not exist or is not what you expect, Docker will create an empty directory and mount it over /htdocs, hiding the files that were copied there during the image build (via COPY linkstack /htdocs).
  • This "mounting over" means that the application inside the container may not see the expected files, leading to missing content or misbehavior.
  • If permissions or ownership are different on the host directory, it might conflict with the chown and chmod commands run during the build, causing access errors for the apache user.

In summary:
Relative bind mounts can "hide" the files in /htdocs that were added during the build, and permissions may not match. Always ensure your bind mount points to the right directory and understand that it will overwrite the contents of /htdocs from the image.

If you want to avoid these issues, use absolute paths on the host and only mount if you know you need to override what's inside the image.

tilllt avatar Jul 29 '25 06:07 tilllt