Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

AuthZRequest for POST /containers/create... authorization denied

Sander Verhagen January 24, 2018

I'm having a Java unit test, which ultimately uses Spotify's Docker Client. It fails to create the Docker container on Bitbucket Pipelines, as follows:

msg="Pipelines plugin request authorization." allowed=true method=GET plugin=pipelines uri=/info
msg="Pipelines plugin request authorization." allowed=true method=GET plugin=pipelines uri=/version
msg="Pipelines plugin request authorization." allowed=true method=GET plugin=pipelines uri="/images/json?filters=%7B%22dangling%22%3A%5B%22false%22%5D%7D"
msg="Pipelines plugin request authorization." allowed=true method=POST plugin=pipelines uri="/images/create?fromImage=mdillon/postgis&tag=9.5-alpine"
msg="Pipelines plugin request authorization." allowed=false method=POST plugin=pipelines uri=/containers/create
msg="AuthZRequest for POST /containers/create returned error: authorization denied by plugin pipelines: Command not supported."
2018-01-24 22:35:09,458 WARN received SIGTERM indicating exit request

As this works fine on my local machine, I'm a little puzzled of what's so different about Pipelines?

I'm not mounting in any volumes, so I don't think it's this issue.

2 answers

1 accepted

0 votes
Answer accepted
Sander Verhagen January 29, 2018

As it turns out, for this to work, I need to include the API version of the Docker server, i.e.:

DockerClient dockerClient = ...;
dockerClient.apiVersion = "1.29";

Not quite that simple (in the code), since DockerClient is immutable, but conceptually this was it.

Ricard Nàcher Roig February 15, 2018

I am trying to create a container for testing but I get the same error you reported.  I added the version to the call too but it does not work. Could you please, add the call that works as you did below? just to compare the headers of the POST call

 My call is as simple as

 

>> "POST /v1.29/containers/create HTTP/1.1[\r][\n]"
>> "Accept: application/json[\r][\n]"
>> "Content-Type: application/json[\r][\n]"
>> "User-Agent: Jersey/2.23.1 (Apache HttpClient 4.5)[\r][\n]"
>> "Transfer-Encoding: chunked[\r][\n]"
>> "Host: localhost:2375[\r][\n]"
>> "Connection: Keep-Alive[\r][\n]"
>> "Accept-Encoding: gzip,deflate[\r][\n]"
>> "[\r][\n]"
>> "81[\r][\n]"
>> "{"Image":"redis","Volumes":{},"ExposedPorts":{},"HostConfig":{"NetworkMode":"default","Privileged":false,"PublishAllPorts":true}}[\r][\n]"
>> "0[\r][\n]"
>> "[\r][\n]"
<< "HTTP/1.1 403 Forbidden[\r][\n]"
<< "Content-Type: application/json[\r][\n]"
<< "Date: Thu, 15 Feb 2018 10:42:44 GMT[\r][\n]"
<< "Content-Length: 79[\r][\n]"
<< "[\r][\n]"
<< "{"message":"authorization denied by plugin pipelines: Command not supported."}[\n]"

 

thanks in advance.  

Sander Verhagen February 15, 2018

Is Bitbucket still at 1.29? You can check with:

docker version --format "{{.Server.APIVersion}}

If Bitbucket were to be using a different (newer) API version, setting it to 1.29 would give you the same problem situation as originally.

This command is also what I use to parameterize the fix that I described, so that it's not hard-coded at 1.29:

export DOCKER_SERVER_API_VERSION="$(docker version --format "{{.Server.APIVersion}}")"
Sander Verhagen March 13, 2018

I'm again researching this, since very similar problems reappeared for us. Did you ever figure this out, @Ricard Nàcher Roig?

Ricard Nàcher Roig March 14, 2018

Hi! I couldn't find any solution. Actually, I opened a question/issue with a very simple example at https://community.atlassian.com/t5/Bitbucket-questions/create-continer-authorization-denied-by-plugin-pipelines-Command/qaq-p/731364

0 votes
Sander Verhagen January 24, 2018

Here is more information:

>> "POST /containers/create HTTP/1.1[\r][\n]"
>> "Accept: application/json[\r][\n]"
>> "Content-Type: application/json[\r][\n]"
>> "User-Agent: Jersey/2.19 (Apache HttpClient 4.5.2)[\r][\n]"
>> "Transfer-Encoding: chunked[\r][\n]"
>> "Host: localhost:2375[\r][\n]"
>> "Connection: Keep-Alive[\r][\n]"
>> "Accept-Encoding: gzip,deflate[\r][\n]"
>> "[\r][\n]"
>> "ad[\r][\n]"
>> "{"Env":["POSTGRES_USER=test","POSTGRES_PASSWORD=test","POSTGRES_DB=test"],"Image":"mdillon/postgis:9.5-alpine","NetworkDisabled":false,"HostConfig":{"PublishAllPorts":true}}[\r][\n]"
>> "0[\r][\n]"
>> "[\r][\n]"
<< "HTTP/1.1 403 Forbidden[\r][\n]"
<< "Content-Type: application/json[\r][\n]"
<< "Date: Thu, 25 Jan 2018 02:10:45 GMT[\r][\n]"
<< "Content-Length: 79[\r][\n]"
<< "[\r][\n]"
<< "{"message":"authorization denied by plugin pipelines: Command not supported."}[\n]"
<< HTTP/1.1 403 Forbidden
<< Content-Type: application/json
<< Date: Thu, 25 Jan 2018 02:10:45 GMT
<< Content-Length: 79

Should I contact something else than "localhost", seems not?

Sander Verhagen January 29, 2018

Evidently this was not an answer, just an elaboration of the question, but please see my "accepted" answer for the real solution.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events