skip to Main Content

whenever I run the dev engine, I get the following error at the end of the install:

chown: invalid group: ‘root:docker’
WARNING: Could not change owner for docker socket in container : exit code 1
Docker socket permission set to allow in container docker

I am on macOS, so not sure if I need to create a docker group or not.

I have the following Dockerfile.devenv

FROM python:3.9-buster
COPY requirements.txt requirements.txt
COPY . .
RUN pip install -r requirements.txt
USER root
WORKDIR /src
EXPOSE 8000
RUN useradd -ms /bin/bash devenv

and no docker compose file.

2

Answers


  1. According to the documentation: https://learn.microsoft.com/en-us/visualstudio/mac/docker-quickstart?view=vsmac-2019

    It could be possible to run the service of Visual Studio by configurating the dockerfile:

    FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
    WORKDIR /app
    EXPOSE 80
    EXPOSE 443
    
    FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
    WORKDIR /src
    COPY DockerDemo/DockerDemo.csproj DockerDemo/
    RUN dotnet restore "DockerDemo/DockerDemo.csproj"
    COPY . .
    WORKDIR "/src/DockerDemo"
    RUN dotnet build "DockerDemo.csproj" -c Release -o /app/build
    
    FROM build AS publish
    RUN dotnet publish "DockerDemo.csproj" -c Release -o /app/publish
    
    FROM base AS final
    WORKDIR /app
    COPY --from=publish /app/publish .
    ENTRYPOINT ["dotnet", "DockerDemo.dll"]
    

    So it could be possible to run your python environment within the environment for visual studio to run over macOS:

    FROM python:3.9-buster
    COPY requirements.txt requirements.txt
    COPY . .
    RUN pip install -r requirements.txt
    USER root
    WORKDIR /src
    EXPOSE 8000
    RUN useradd -ms /bin/bash devenv
    
    FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
    WORKDIR /src
    EXPOSE 80
    EXPOSE 443
    
    FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
    WORKDIR /src
    COPY DockerDemo/DockerDemo.csproj DockerDemo/
    RUN dotnet restore "DockerDemo/DockerDemo.csproj"
    COPY . .
    WORKDIR "/src/DockerDemo"
    RUN dotnet build "DockerDemo.csproj" -c Release -o /app/build
    
    FROM build AS publish
    RUN dotnet publish "DockerDemo.csproj" -c Release -o /app/publish
    
    FROM base AS final
    WORKDIR /src
    COPY --from=publish /app/publish .
    ENTRYPOINT ["dotnet", "DockerDemo.dll"]
    
    Login or Signup to reply.
  2. Based on docker documentation when we are specifying Dockerfile, we need to make sure that we are using vscode user and included to docker group.

    So i think your Dockerfile.devenv need to be updated. e.g:

    FROM python:3.9-buster
    
    WORKDIR /src
    COPY requirements.txt requirements.txt
    COPY . .
    RUN pip install -r requirements.txt
    
    # create vscode user then add to docker group
    RUN useradd -s /bin/bash -m vscode 
     && groupadd docker 
     && usermod -aG docker vscode
    
    USER vscode
    
    EXPOSE 8000
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search