Skip to content

Conversation

@ijc
Copy link
Contributor

@ijc ijc commented Mar 22, 2018

The go-tar implementation which is used cannot handle sockets.

There's no good reason to preserve a socket, they are basically useless without
the process which made them.

Signed-off-by: Ian Campbell [email protected]

I discovered this with https://github.com/dotnet/dotnet-docker-samples/tree/master/aspnetapp and buildkit's dockerfile frontend which gave:

aspnetapp$ sudo $(which buildctl) build --frontend=dockerfile.v0 --local context=. --local dockerfile=. --exporter=image --exporter-opt=name=foo --frontend-opt target=build-env
[...]
=> ERROR exporting to image                                                                               1.0s
=> => exporting layers                                                                                    4.0s
------
> exporting to image:
------
error: failed to solve: rpc error: code = Unknown desc = failed calculaing diff pairs for exported snapshot: rpc error: code = Unknown desc = failed to write compressed diff: failed to create diff tar stream: tar: sockets not supported

While a docker build works.

The go-tar implementation which is used cannot handle sockets.

There's no good reason to preserve a socket, they are basically useless without
the process which made them.

Signed-off-by: Ian Campbell <[email protected]>
@ijc
Copy link
Contributor Author

ijc commented Mar 22, 2018

If accepted would be good to have this in v1.0.x too I think.

@codecov-io
Copy link

codecov-io commented Mar 22, 2018

Codecov Report

Merging #2222 into master will increase coverage by 0.02%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2222      +/-   ##
==========================================
+ Coverage   41.06%   41.09%   +0.02%     
==========================================
  Files          66       66              
  Lines        7748     7751       +3     
==========================================
+ Hits         3182     3185       +3     
- Misses       4064     4065       +1     
+ Partials      502      501       -1
Flag Coverage Δ
#windows 41.09% <0%> (+0.02%) ⬆️
Impacted Files Coverage Δ
archive/tar.go 16.85% <0%> (-0.12%) ⬇️
gc/scheduler/scheduler.go 68.44% <0%> (+1.45%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9304193...9b111bd. Read the comment docs.

@stevvooe
Copy link
Member

LGTM

Would it be possible to create a test?

Also, let’s backport this one.

@stevvooe stevvooe added this to the 1.1 milestone Mar 22, 2018
@ijc
Copy link
Contributor Author

ijc commented Mar 22, 2018

I'll have a look at a test now, I've got about 25 mins left today so it might be tomorrow before it is done.

ijc pushed a commit to ijc/continuity that referenced this pull request Mar 22, 2018
I need this in order to test containerd/containerd#2222

Signed-off-by: Ian Campbell <[email protected]>
ijc pushed a commit to ijc/continuity that referenced this pull request Mar 22, 2018
I need this in order to test containerd/containerd#2222

Signed-off-by: Ian Campbell <[email protected]>
ijc pushed a commit to ijc/continuity that referenced this pull request Mar 22, 2018
I need this in order to test containerd/containerd#2222

Signed-off-by: Ian Campbell <[email protected]>
@ijc
Copy link
Contributor Author

ijc commented Mar 22, 2018

I have a test now, but it depends on containerd/continuity#110. It looks like:

diff --git a/archive/tar_test.go b/archive/tar_test.go
index 4d56d4e2..c94c9d37 100644
--- a/archive/tar_test.go
+++ b/archive/tar_test.go
@@ -1022,6 +1022,22 @@ func TestDiffTar(t *testing.T) {
 				fstest.CreateDir("/d3/", 0755),
 			),
 		},
+		{
+			name: "IgnoreSockets",
+			validators: []tarEntryValidator{
+				fileEntry("f2", []byte("content"), 0644),
+				// There should be _no_ socket here, despite the fstest.CreateSocket below
+				fileEntry("f3", []byte("content"), 0644),
+			},
+			a: fstest.Apply(
+				fstest.CreateFile("/f1", []byte("content"), 0644),
+			),
+			b: fstest.Apply(
+				fstest.CreateFile("/f2", []byte("content"), 0644),
+				fstest.CreateSocket("/s0", 0644),
+				fstest.CreateFile("/f3", []byte("content"), 0644),
+			),
+		},
 	}
 
 	for _, at := range tests {

Signed-off-by: Derek McGowan <[email protected]>
@dmcgowan
Copy link
Member

LGTM

@dmcgowan dmcgowan merged commit 382b313 into containerd:master Mar 22, 2018
@ijc
Copy link
Contributor Author

ijc commented Mar 23, 2018

Awesome, thanks for sorting the test!

@ijc ijc deleted the ignore-sockets-in-archiver branch March 23, 2018 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants