From 85f5d1123df9ad4030f3947ff9c61e493fbfccf0 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sun, 25 Oct 2020 18:54:07 +0100 Subject: [PATCH] Set the content type header on build Prior to this patch, the application/json Content-Type header was set but he body is a tar file as returned by Docker::Util.create_tar. That this code was there for a long time suggests Docker doesn't check the content type. However, podman's REST API does check the header and rejects the request. After this patch, it is accepted. --- lib/docker/image.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/docker/image.rb b/lib/docker/image.rb index 4e17531f6..b7614eeeb 100644 --- a/lib/docker/image.rb +++ b/lib/docker/image.rb @@ -252,6 +252,7 @@ def build(commands, opts = {}, connection = Docker.connection, &block) body = "" connection.post( '/build', opts, + :headers => { 'Content-Type' => 'application/tar' }, :body => Docker::Util.create_tar('Dockerfile' => commands), :response_block => response_block(body, &block) )