Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

archive/tar: sockets not supported #272

Closed
MnrGreg opened this issue Aug 2, 2018 · 7 comments · Fixed by #288
Closed

archive/tar: sockets not supported #272

MnrGreg opened this issue Aug 2, 2018 · 7 comments · Fixed by #288
Assignees
Labels
kind/bug Something isn't working

Comments

@MnrGreg
Copy link

MnrGreg commented Aug 2, 2018

Experiencing the following error during 3rd stage of multistage build (FROM build AS publish):

INFO[0129] args: [-c dotnet build XXXXX.API.Core.csproj -c Release -o /app]
Microsoft (R) Build Engine version 15.7.179.6572 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restoring packages
[redacted]
Time Elapsed 00:00:06.90
INFO[0136] Taking snapshot of full filesystem...
ERRO[0152] archive/tar: sockets not supported

Dockerfile:

FROM microsoft/aspnetcore:2.0 AS base
WORKDIR /app
EXPOSE 18080
RUN adduser --system appuser

FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY XX.API.Core/XX.API.Core.csproj XX.API.Core/
COPY XX.API.Data/XX.API.Data.csproj XX.API.Data/
ENV NUGET_PACKAGES=/root/.nuget/packages
ENV HOME=/root
RUN dotnet restore XX.API.Core/XX.API.Core.csproj
COPY . .
WORKDIR /src/XX.API.Core
RUN dotnet build XX.API.Core.csproj -c Release -o /app

FROM build AS publish
RUN dotnet publish XX.API.Core.csproj -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
RUN chown -R appuser /app
ENV ASPNETCORE_URLS="http://*:18080"
USER appuser
ENTRYPOINT ["dotnet", "XX.API.Core.dll"]
@priyawadhwa priyawadhwa added the kind/bug Something isn't working label Aug 3, 2018
@dlorenc
Copy link
Collaborator

dlorenc commented Aug 6, 2018

Is there a github repo somewhere we can try to repro this against? I see some COPY lines in the Dockerfile and I'm not sure what type of files would go there.

@MnrGreg
Copy link
Author

MnrGreg commented Aug 7, 2018

Here is a sample GitHub repo where the error 'archive/tar: sockets not supported' is experienced.

https://github.com/dotnet/dotnet-docker/blob/master/samples/dotnetapp/Dockerfile

Just add ENV HOME=/root to the 3rd line of the Dockerfile which dotnet restore requires

@priyawadhwa
Copy link
Collaborator

Cool, so I was able to reproduce this error

INFO[0136] Taking snapshot of full filesystem...
ERRO[0152] archive/tar: sockets not supported

The error comes when trying to get a FileInfoHeader for a socket and adding it to the layer tar, which the tar library doesn't allow.

I added logging to see which files were causing this error:

level=info msg="Taking snapshot of full filesystem..."
level=info msg="ignoring socket CoreFxPipe_root.F.w_DeYmAB2l6Qi1gOte+2G9vHA, not adding to tar"

CoreFxPipe_root.F.w_DeYmAB2l6Qi1gOte+2G9vHA was the only file that caused this error, so I first tried building the first stage (which was the stage giving the error) with Docker to see how it dealt with the file. Built with Docker, the image didn't contain this file.

I added code to ignore the socket and built the first stage with Docker and kaniko. The container-diff output was:

-----File-----

These entries have been added to test: None

These entries have been deleted from test: None

These entries have been changed between test and gcr.io/priya-wadhwa/test:test:
FILE                                                                                    SIZE1        SIZE2
/app/dotnetapp/obj/Release/netcoreapp2.1/dotnetapp.csprojAssemblyReference.cache        80.2K        80.2K
/app/utils/obj/Release/netstandard2.0/utils.csprojAssemblyReference.cache               62.4K        62.4K
/root/.dotnet/optimizationdata/2.1.302/debian.9-x64/dotnet                              8.1K         7.4K
/tmp/.dotnet/shm/session1/root.F.w_DeYmAB2l6Qi1gOte+2G9vHA.server                       4K           4K

I'm not totally sure if these are all files we can ignore, but right now the only thing I can think to do is ignore sockets entirely. Suggestions welcome!

@dlorenc
Copy link
Collaborator

dlorenc commented Aug 13, 2018

Yeah I think we should ignore sockets when tarring up the layer.

@priyawadhwa
Copy link
Collaborator

Hey @MnrGreg , this should work now, please open another issue if it doesn't!

@MnrGreg
Copy link
Author

MnrGreg commented Aug 14, 2018

Yup, sockets are now skipped and build completes.

@priyawadhwa priyawadhwa self-assigned this Feb 12, 2019
@antonyjohnpaul23us
Copy link

Th issue seems to have re-surfaced in version 1.9

ERRO[0061] Can't add file /data/var/lib/containers/storage/overlay/dbecfc96d215e991ac3c5a84e1c7c31c4ab45cb801ee9c8a160f8f9336ce3758/diff/tmp/CoreFxPipe_MSBuild106 to tar: archive/tar: sockets not supported
ERRO[0061] Can't add file /data/var/lib/containers/storage/overlay/dbecfc96d215e991ac3c5a84e1c7c31c4ab45cb801ee9c8a160f8f9336ce3758/diff/tmp/CoreFxPipe_MSBuild74 to tar: archive/tar: sockets not supported
ERRO[0061] Can't add file /data/var/lib/containers/storage/overlay/dbecfc96d215e991ac3c5a84e1c7c31c4ab45cb801ee9c8a160f8f9336ce3758/diff/tmp/CoreFxPipe_MSBuild91 to tar: archive/tar: sockets not supported
ERRO[0061] Can't add file /data/var/lib/containers/storage/overlay/dbecfc96d215e991ac3c5a84e1c7c31c4ab45cb801ee9c8a160f8f9336ce3758/diff/tmp/xgicJLh614PpucyV4Nn9s_uL0EDEHYOnMe1l7fuQkb8 to tar: archive/tar: sockets not supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants