[Bug] cant run docker compose #36

Closed
opened 2025-11-22 15:15:41 +00:00 by 22347526 · 1 comment
Member

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

PS C:\Users\luker\Documents\GitHub\Group_2_IAM_SYSTEM> docker compose -f deployments/docker-compose/docker-compose.yml up -d
time="2025-11-22T15:14:25Z" level=warning msg="C:\Users\luker\Documents\GitHub\Group_2_IAM_SYSTEM\deployments\docker-compose\docker-compose.yml: the attribute version is obsolete, it will be ignored, please remove it to avoid potential confusion"
[+] Building 3.3s (12/13)
=> [internal] load local bake definitions 0.0s
=> => reading from stdin 1.23kB 0.0s
=> [auth-service internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 185B 0.0s
=> [user-service internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 185B 0.0s
=> [user-service internal] load metadata for docker.io/library/eclipse-temurin:21-jdk 1.4s
=> [auth] library/eclipse-temurin:pull token for registry-1.docker.io 0.0s
=> [auth-service internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [user-service internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [auth-service internal] load build context 0.0s
=> => transferring context: 2B 0.0s
=> CANCELED [user-service 1/3] FROM docker.io/library/eclipse-temurin:21-jdk@sha256:ec2005c536f3661c6ef1253292c9c623e582186749a3ef2ed90903d1aaf74640 0.4s
=> => resolve docker.io/library/eclipse-temurin:21-jdk@sha256:ec2005c536f3661c6ef1253292c9c623e582186749a3ef2ed90903d1aaf74640 0.0s
=> [user-service internal] load build context 0.0s
=> => transferring context: 2B 0.0s
=> CACHED [user-service 2/3] WORKDIR /app 0.0s
=> ERROR [auth-service 3/3] COPY target/auth-service-1.0-SNAPSHOT.jar app.jar 0.0s
=> ERROR [user-service 3/3] COPY target/user-service-1.0-SNAPSHOT.jar app.jar 0.0s

[auth-service 3/3] COPY target/auth-service-1.0-SNAPSHOT.jar app.jar:



[user-service 3/3] COPY target/user-service-1.0-SNAPSHOT.jar app.jar:


Dockerfile:5


3 | WORKDIR /app

4 |

5 | >>> COPY target/auth-service-1.0-SNAPSHOT.jar app.jar

6 |

7 | EXPOSE 8082


target auth-service: failed to solve: failed to compute cache key: failed to calculate checksum of ref g3rvpq7jfoh9kq7lmpxtpr2e8::ataultenmuvfncyo9pkvncbj7: "/target/auth-service-1.0-SNAPSHOT.jar": not found

PS C:\Users\luker\Documents\GitHub\Group_2_IAM_SYSTEM>

Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows PS C:\Users\luker\Documents\GitHub\Group_2_IAM_SYSTEM> docker compose -f deployments/docker-compose/docker-compose.yml up -d time="2025-11-22T15:14:25Z" level=warning msg="C:\\Users\\luker\\Documents\\GitHub\\Group_2_IAM_SYSTEM\\deployments\\docker-compose\\docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion" [+] Building 3.3s (12/13) => [internal] load local bake definitions 0.0s => => reading from stdin 1.23kB 0.0s => [auth-service internal] load build definition from Dockerfile 0.1s => => transferring dockerfile: 185B 0.0s => [user-service internal] load build definition from Dockerfile 0.1s => => transferring dockerfile: 185B 0.0s => [user-service internal] load metadata for docker.io/library/eclipse-temurin:21-jdk 1.4s => [auth] library/eclipse-temurin:pull token for registry-1.docker.io 0.0s => [auth-service internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [user-service internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [auth-service internal] load build context 0.0s => => transferring context: 2B 0.0s => CANCELED [user-service 1/3] FROM docker.io/library/eclipse-temurin:21-jdk@sha256:ec2005c536f3661c6ef1253292c9c623e582186749a3ef2ed90903d1aaf74640 0.4s => => resolve docker.io/library/eclipse-temurin:21-jdk@sha256:ec2005c536f3661c6ef1253292c9c623e582186749a3ef2ed90903d1aaf74640 0.0s => [user-service internal] load build context 0.0s => => transferring context: 2B 0.0s => CACHED [user-service 2/3] WORKDIR /app 0.0s => ERROR [auth-service 3/3] COPY target/auth-service-1.0-SNAPSHOT.jar app.jar 0.0s => ERROR [user-service 3/3] COPY target/user-service-1.0-SNAPSHOT.jar app.jar 0.0s ------ > [auth-service 3/3] COPY target/auth-service-1.0-SNAPSHOT.jar app.jar: ------ ------ > [user-service 3/3] COPY target/user-service-1.0-SNAPSHOT.jar app.jar: ------ Dockerfile:5 -------------------- 3 | WORKDIR /app 4 | 5 | >>> COPY target/auth-service-1.0-SNAPSHOT.jar app.jar 6 | 7 | EXPOSE 8082 -------------------- target auth-service: failed to solve: failed to compute cache key: failed to calculate checksum of ref g3rvpq7jfoh9kq7lmpxtpr2e8::ataultenmuvfncyo9pkvncbj7: "/target/auth-service-1.0-SNAPSHOT.jar": not found PS C:\Users\luker\Documents\GitHub\Group_2_IAM_SYSTEM>

Root Cause

The Docker build is trying to copy JAR files that don't exist yet. Maven must compile and package the code before Docker can build the images.


Try THis:

Option 1: Command Line (Recommended for CI/CD)

Run these commands from the project root directory:

1. Build all services (creates JAR files in target/ directories)

mvn clean package -DskipTests

2. Build and start Docker containers

docker compose -f deployments/docker-compose/docker-compose.yml up -d

3. Verify all containers are running

docker compose -f deployments/docker-compose/docker-compose.yml ps


Option 2: IntelliJ IDE

Step 1: Open Maven Build Panel

  1. Go to View → Tool Windows → Maven
  2. Right panel will show Maven Projects

Step 2: Build the Project

  1. Expand the root project: Group_2_IAM_SYSTEM
  2. Expand Lifecycle
  3. Double-click clean (waits for it to finish)
  4. Then double-click package
    - Do NOT run tests: Right-click → Run with profile → Check "Skip Tests"
    - Or use terminal command shown above

Step 3: Verify JAR Files Created

  1. In IntelliJ, open Project panel (left sidebar)
  2. Navigate to: src/services/auth-service/target/ → Should see auth-service-1.0-SNAPSHOT.jar
  3. Navigate to: src/services/user-service/target/ → Should see user-service-1.0-SNAPSHOT.jar
  4. Navigate to: src/services/role-service/target/ → Should see role-service-1.0-SNAPSHOT.jar

Step 4: Start Docker Compose

  1. Open Terminal in IntelliJ (bottom panel)
  2. Run:
    docker compose -f deployments/docker-compose/docker-compose.yml up -d
  3. Or use Docker extension in IntelliJ:
    - Services tab (left) → Docker → Right-click docker-compose.yml → Compose Up

Step 5: Verify Containers

docker compose -f deployments/docker-compose/docker-compose.yml ps

Root Cause The Docker build is trying to copy JAR files that don't exist yet. Maven must compile and package the code before Docker can build the images. --- Try THis: Option 1: Command Line (Recommended for CI/CD) Run these commands from the project root directory: # 1. Build all services (creates JAR files in target/ directories) mvn clean package -DskipTests # 2. Build and start Docker containers docker compose -f deployments/docker-compose/docker-compose.yml up -d # 3. Verify all containers are running docker compose -f deployments/docker-compose/docker-compose.yml ps --- Option 2: IntelliJ IDE Step 1: Open Maven Build Panel 1. Go to View → Tool Windows → Maven 2. Right panel will show Maven Projects Step 2: Build the Project 1. Expand the root project: Group_2_IAM_SYSTEM 2. Expand Lifecycle 3. Double-click clean (waits for it to finish) 4. Then double-click package - Do NOT run tests: Right-click → Run with profile → Check "Skip Tests" - Or use terminal command shown above Step 3: Verify JAR Files Created 1. In IntelliJ, open Project panel (left sidebar) 2. Navigate to: src/services/auth-service/target/ → Should see auth-service-1.0-SNAPSHOT.jar 3. Navigate to: src/services/user-service/target/ → Should see user-service-1.0-SNAPSHOT.jar 4. Navigate to: src/services/role-service/target/ → Should see role-service-1.0-SNAPSHOT.jar Step 4: Start Docker Compose 1. Open Terminal in IntelliJ (bottom panel) 2. Run: docker compose -f deployments/docker-compose/docker-compose.yml up -d 3. Or use Docker extension in IntelliJ: - Services tab (left) → Docker → Right-click docker-compose.yml → Compose Up Step 5: Verify Containers docker compose -f deployments/docker-compose/docker-compose.yml ps
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
2025/Group_2_IAM_SYSTEM#36
No description provided.