How I Fixed: docker: Error response from daemon: Decoding seccomp profile failed: json: cannot unmarshal array into Go value of type seccomp.Seccomp.

Another day, another cryptic error message from Docker.

Right, so here’s what I was trying to do.

Blindly following the Playwright docs for getting a Playwright Docker container up and running, I first created a new file, seccomp_profile.json inside the current directory. The location of this directory is irrelevant, just the file needs to live in the directory from which you (or I) run the command.

And the command is directly lifted from the 1.14 docs:

docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json /bin/bash

When doing this, I got the error above, but for clarity (and for SEO purposes) here it is again:

docker: Error response from daemon: Decoding seccomp profile failed: json: cannot unmarshal array into Go value of type seccomp.Seccomp.

This tells us that whilst the file was read, the contents are somehow wrong.

I’m just going to skip straight to the fix here, as I tried a few things and got lucky. Sadly, I don’t know jack about Golang, but I loosely understand the error above as saying hey, Chris, that JSON file doesn’t decode into a format my program is expecting.

Here’s what MS give:

    "comment": "Allow create user namespaces",
    "names": [
    "action": "SCMP_ACT_ALLOW",
    "args": [],
    "includes": {},
    "excludes": {}

And here’s what it needs to be:

    "comment": "Allow create user namespaces",
    "names": [
    "action": "SCMP_ACT_ALLOW",
    "args": [],
    "includes": {},
    "excludes": {}

Or, in short, not an array. Just a single object.

Why the docs have it that way, I don’t know.

Go figure.

Arf arf.

[How I Fixed] Installing Go on Ubuntu 16.04

I wanted to install Go on Ubuntu 16.04. I thought this would be easy. It kinda is, but it wasn’t super easy.

By easy I mean I found a bunch of copy / paste instructions, but not everything worked first time.

I found out about a tool called gvm , which is similar to nvm  – in other words, a Go Version Manager.

Here’s what I had to do:

bash < <(curl -s -S -L

This prompted me to run a further command:

source /home/chris/.gvm/scripts/gvm

When I tried to run:

gvm version

I was prompted to install bison:

sudo apt-get install bison

I then ran:

gvm listall

Which showed go1.9.2 as being the latest and greatest.

gvm install go1.9.2

Unfortunately that failed.

The instructions I found gave a suggested fix, but this didn’t work. Here’s what did work for me:

gvm install go1.4 --binary
gvm use go1.4
gvm install go1.9.2
gvm use go1.9.2

After which:

go version

go version go1.9.2 linux/amd64


For what it’s worth:

go env

GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build165142315=/tmp/go-build -gno-record-gcc-switches"

I also hit on a bunch of confusing issues because I’d set my package name to be something different to main .

I’d set my package name to cfbl which resulted in this like this:

cfbl go build   
cfbl go install                            
go install: no install location for directory /home/chris/Development/go/cfbl outside GOPATH
	For more details see: 'go help gopath'

cfbl go run test.go
go run: cannot run non-main package

Inside test.go (which isn’t a TDD style test, just my testing with go) I had to make sure to use package main

I hope that saves someone some confusion.