Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

docker error #12180


User avatar
0
FahrettinOzturk created

I am trying to run docker on my mac. https://docs.aspnetzero.com/aspnet-core-angular/latest/Deployment-Angular-Docker I read this document.

  1. I locate my terminal to this folder /Users/hsudas/Documents/GitHub/AnalisionFrontendV2/aspnet-core/build and run this command pwsh build-with-ng.ps1 (I installed powershell to Mac computer )
  2. Then locate to /Users/hsudas/Documents/GitHub/AnalisionFrontendV2/aspnet-core/build/outputs/Host and run this command docker compose -f docker-compose.yml -f docker-compose.override.yml up Finally got his error.

WARN[0000] /Users/hsudas/Documents/GitHub/AnalisionFrontendV2/aspnet-core/build/outputs/Host/docker-compose.yml: the attribute version is obsolete, it will be ignored, please remove it to avoid potential confusion WARN[0000] The "APPDATA" variable is not set. Defaulting to a blank string. WARN[0000] The "APPDATA" variable is not set. Defaulting to a blank string. WARN[0000] /Users/hsudas/Documents/GitHub/AnalisionFrontendV2/aspnet-core/build/outputs/Host/docker-compose.override.yml: the attribute version is obsolete, it will be ignored, please remove it to avoid potential confusion [+] Running 1/1 ! mycompanyname.abpzerotemplate.web.host Warning pull access denied for mycompanyname.abpzerotemplate.web.host, repository does not exist or may... 0.7s [+] Building 1.0s (9/9) FINISHED docker:desktop-linux => [mycompanyname.abpzerotemplate.web.host internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 287B 0.0s => [mycompanyname.abpzerotemplate.web.host internal] load metadata for mcr.microsoft.com/dotnet/aspnet:7.0 0.1s => [mycompanyname.abpzerotemplate.web.host internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [mycompanyname.abpzerotemplate.web.host 1/3] FROM mcr.microsoft.com/dotnet/aspnet:7.0@sha256:c7d9ee6cd01afe9aa80642e577c7cec9f5d87f88e5d70bd36fd61072079bc55b 0.0s => => resolve mcr.microsoft.com/dotnet/aspnet:7.0@sha256:c7d9ee6cd01afe9aa80642e577c7cec9f5d87f88e5d70bd36fd61072079bc55b 0.0s => [mycompanyname.abpzerotemplate.web.host internal] load build context 0.0s => => transferring context: 40.41kB 0.0s => CACHED [mycompanyname.abpzerotemplate.web.host 2/3] WORKDIR /app 0.0s => CACHED [mycompanyname.abpzerotemplate.web.host 3/3] COPY . . 0.0s => [mycompanyname.abpzerotemplate.web.host] exporting to image 0.7s => => exporting layers 0.0s => => exporting manifest sha256:789b3df905315820d5a6104b1c9f1fd1287fbd61bfd2fd9ee8eea58ab67b7608 0.0s => => exporting config sha256:1a7d4fda8ba8a8466a1f1685b29db7ea0070add00ceaa4987f1b3f4d469ed18e 0.0s => => exporting attestation manifest sha256:d2f1bf7e9c46db825d151223739a2eac411f96213279c246636c20eb4a7e1658 0.0s => => exporting manifest list sha256:4aeac00514bd37457af84689603ee278b3747099e9804f45eaea3bc860c2ce02 0.0s => => naming to docker.io/library/mycompanyname.abpzerotemplate.web.host:latest 0.0s => => unpacking to docker.io/library/mycompanyname.abpzerotemplate.web.host:latest 0.7s => [mycompanyname.abpzerotemplate.web.host] resolving provenance for metadata file 0.0s [+] Running 2/2 ✔ Network host_default Created 0.0s ✔ Container mycompanyname.abpzerotemplate.web.host_container Created 0.2s Attaching to mycompanyname.abpzerotemplate.web.host_container Gracefully stopping... (press Ctrl+C again to force) Error response from daemon: Mounts denied: The path /Microsoft/UserSecrets is not shared from the host and is not known to Docker. You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing. See https://docs.docker.com/desktop/settings/mac/#file-sharing for more info.


4 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi FahrettinOzturk

    The error you're encountering happens because Docker is trying to access certain directories on your Mac's file system, specifically /Microsoft/UserSecrets, but it doesn't have permission. To resolve this, you need to share that directory with Docker.

    Steps to Fix:

    Open Docker Preferences:

    • Click on the Docker icon in the top-right menu bar of your Mac and select "Preferences."

    Go to File Sharing Settings:

    • In the Preferences window, navigate to the Resources section on the left, and then click on File Sharing.

    Add the Directory:

    • In the File Sharing tab, you'll see a list of directories that Docker is allowed to access.
    • Click the + button, and add the /Microsoft/UserSecrets directory.
    • After adding it, click "Apply & Restart" to save the changes.

    Restart Docker:

    • Docker will restart automatically after applying the changes.

    Run Your Commands Again:

    • Once Docker restarts, try running your command again:
    docker compose -f docker-compose.yml -f docker-compose.override.yml up
    

    These steps should allow Docker to access the necessary directory, and the error should be resolved.

    If the issue persists, don’t hesitate to reach out for further assistance.

  • User Avatar
    0
    FahrettinOzturk created

    I already applied these instructions since Chat GPT gave exactly same. But the problem is I don't have UserSecrets folder in my mac.

  • User Avatar
    0
    m.aliozkaya created
    Support Team

    Hi @FahrettinOzturk,

    Could you try to create user secrets with the following document?

    dotnet user-secrets init

    https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-8.0&tabs=linux

  • User Avatar
    0
    FahrettinOzturk created

    Nope Not worked. Since I am using mac I have changed ${APPDATA} to ~ - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro

    And then in YML files changed FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base to FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base now worked