compose icon indicating copy to clipboard operation
compose copied to clipboard

[BUG] Docker compose ignoring .dockerignore in git repo

Open guidopetri opened this issue 2 years ago • 3 comments

Description

I'm attempting to build a service from a git repo. This build works when using docker build -f Dockerfile.client ., but does not when running docker compose -d up cleanslate_frontend_builder to build and start the service. The git repo can be found here, and I'm building the Dockerfile.client dockerfile. The specific error I get is related to typing and makes it clear that the .dockerignore in the root of the repo is being ignored, and can be found in this issue in the cleanslate repo.

  cleanslate_frontend_builder:
    build:
      context: https://github.com/guidopetri/cleanslate.git#main
      dockerfile: Dockerfile.client
      args:
        - NEXT_PUBLIC_VERSION=gpetri-b1d904c
        - NEXT_PUBLIC_HASURA_DOMAIN=cleanslate.${SITE_HOSTNAME}
    entrypoint: ''
    command: '/bin/bash'
    container_name: cleanslate_frontend
    restart: no
    depends_on:
      - cleanslate_backend
    volumes:
      - certbot_ssl:/etc/ssl:ro
      - cleanslate_files:/build

Steps To Reproduce

  1. Set up docker-compose.yml with the service listed above.
  2. Run docker compose up -d cleanslate_frontend_builder
  3. FAIL: The build fails because it's trying to use typing on files that are in the .dockerignore.

Compose Version

`docker compose version`:

`Docker Compose version v2.21.0`

`docker-compose version`:

`-bash: docker-compose: command not found`

Docker Environment

Client: Docker Engine - Community
 Version:    24.0.6
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.2
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.21.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 14
  Running: 14
  Paused: 0
  Stopped: 0
 Images: 34
 Server Version: 24.0.6
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk s                                                                                                                                                             yslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 61f9fd88f79f081d64d6fa3bb1a0dc71ec870523
 runc version: v1.1.9-0-gccaecfc
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.1.21-v8+
 Operating System: Debian GNU/Linux 11 (bullseye)
 OSType: linux
 Architecture: aarch64
 CPUs: 4
 Total Memory: 7.628GiB
 Name: <redacted>
 ID: b3a479bb-df04-4006-916d-b47fbd57041d
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No memory limit support
WARNING: No swap limit support

Anything else?

Issue in the cleanslate repo, where I originally encountered the bug: https://github.com/successible/cleanslate/issues/181

guidopetri avatar Oct 11 '23 01:10 guidopetri

Hello, @guidopetri.

  • there is no cleanslate_backend (did you mean server?).
  • I also cannot see the linked issue :( I get a 404

I tried running an independent docker-compose.yml like so

services:
  cleanslate_frontend_builder:
    build:
      context: https://github.com/guidopetri/cleanslate.git#main
      dockerfile: Dockerfile.client
      args:
        - NEXT_PUBLIC_VERSION=gpetri-b1d904c
        - NEXT_PUBLIC_HASURA_DOMAIN=localhost
    entrypoint: ''
    command: '/bin/bash'
    container_name: cleanslate_frontend
    restart: no
    # removed depends_on since the service does not exist
    volumes:
      - certbot_ssl:/etc/ssl:ro
      - cleanslate_files:/build

volumes:
  certbot_ssl:
  cleanslate_files:

with the docker compose version (and current latest) you mentioned and I did not get any error. Could you also copy paste the exact error message you are getting? Screenshot 2024-01-10 at 14 45 59

jhrotko avatar Jan 10 '24 14:01 jhrotko

  • there is no cleanslate_backend (did you mean server?).

No, that was just a snippet of the docker compose. I neglected to remove the depends_on, that's my fault.

  • I also cannot see the linked issue :( I get a 404

I think the repo got recreated and the issue history was lost :( I also don't recall the details of the original issue.

I can retry the build and copy the logs here, though probably only this weekend, I apologize. I'll also try updating to the latest docker compose if it does not work.

guidopetri avatar Jan 11 '24 03:01 guidopetri

@guidopetri any updates? Did you try running with the latest version v2.24.4?

jhrotko avatar Jan 30 '24 15:01 jhrotko

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jul 28 '24 00:07 github-actions[bot]