Bug 227618 - sysutils/docker-freebsd: Cannot run docker run hello-world
Summary: sysutils/docker-freebsd: Cannot run docker run hello-world
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: Jochen Neumeister
URL:
Keywords: needs-qa, patch, regression
Depends on:
Blocks:
 
Reported: 2018-04-18 18:00 UTC by Dave Barnes
Modified: 2019-01-15 08:19 UTC (History)
16 users (show)

See Also:
linimon: maintainer-feedback? (amutu)


Attachments
Fix 'docker run' on Go 1.10 (3.18 KB, patch)
2018-06-23 12:47 UTC, Ting-Wei Lan
no flags Details | Diff
Fix 'docker run' on Go 1.10 and workaround 'docker info' crash (4.07 KB, patch)
2018-06-26 14:12 UTC, Ting-Wei Lan
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Barnes 2018-04-18 18:00:24 UTC
I installed docker-freebsd from ports on FreeBSD 11.1-RELEASE-p9 (GENERIC), and while the installation was successful, I am unable to run the hello-world image.

# docker run hello-world
Error response from daemon: json: cannot set embedded pointer to unexported struct: runconfig.hostConfigWrapper

The command `docker pull hello-world` works fine, as does `docker ps`.  I just cannot run any docker containers.

I have 64 bit linux emulation enabled.
Comment 1 Arne Ehrlich 2018-05-11 15:53:21 UTC
I see the same behavior.

# docker run hello-world
Error response from daemon: json: cannot set embedded pointer to unexported struct: runconfig.hostConfigWrapper


FreeBSD damogran.local 11.2-PRERELEASE FreeBSD 11.2-PRERELEASE #0 r333008: Thu Apr 26 16:34:42 UTC 2018     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
Comment 2 John Smith 2018-06-02 00:06:03 UTC
Seeing the same.

Can we mark this port as BROKEN to not trick people into thinking that Docker works on FreeBSD?
Comment 3 John Smith 2018-06-02 00:08:53 UTC
p.s.: I've built docker-freebsd from ports (using synth), on FreeBSD 11.1-RELEASE-p10 (x64).
Comment 4 Vicente 2018-06-14 14:34:49 UTC
I'm having the same problem after install through pkg install docker-freebsd. (not ports)

FreeBSD  11.2-RC2 FreeBSD 11.2-RC2 #0 r334861: Sat Jun  9 03:23:08 UTC 2018     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64

The problems start when trying to pull the images:

% docker pull centos
latest: Pulling from centos
29466d114cd8: Extracting [========>                                          ] 12.26 MB/74.69 MB
b298d692482d: Download complete 
88ec626ba223: Download complete 
Pulling repository centos
Repository not found

After trying another image:

% docker pull auchida/freebsd
latest: Pulling from auchida/freebsd
d5732e76584a: Pull complete 
a2b331a1c598: Pull complete 
da76cd0d865f: Pull complete 
3690474eb5b4: Already exists 
Digest: sha256:6dba3de9a41fd4a392864ac5150b059dc3410e6d98cdda0f3a6dd45df3a52f4c
Status: Downloaded newer image for auchida/freebsd:latest
% docker run -t -i auchida/freebsd /bin/bash

Starting the machine I had the same issue.

Error response from daemon: json: cannot set embedded pointer to unexported struct: runconfig.hostConfigWrapper
Comment 5 Ting-Wei Lan 2018-06-23 12:47:38 UTC
Created attachment 194534 [details]
Fix 'docker run' on Go 1.10

I saw the same error when using docker, and this simple patch seems to fix it.
Comment 6 Ting-Wei Lan 2018-06-26 14:12:31 UTC
Created attachment 194650 [details]
Fix 'docker run' on Go 1.10 and workaround 'docker info' crash

This updated patch includes a workaround patch to avoid docker daemon panic on 'docker info' command.
Comment 7 NAMO 2018-07-04 20:29:28 UTC
Greetings, 

I faced the same issue on vanilla 12 installation via pkg:
docker run hello-world
Error response from daemon: json: cannot set embedded pointer to unexported struct: runconfig.hostConfigWrapper


As discussed above, on vanilla 12 installation, I applied the patch (194650 referenced above) and now I get either "Repository not found" or "FATAL: kernel too old":

docker pull centos
latest: Pulling from centos
29466d114cd8: Extracting [========>                                          ] 12.26 MB/74.69 MB
b298d692482d: Download complete 
88ec626ba223: Download complete 
Pulling repository centos
Repository not found


docker pull ubuntu
latest: Pulling from ubuntu
893c22467b8c: Pull complete 
956e81104ad3: Pull complete 
fc67a0888591: Pull complete 
2181b69ee6eb: Pull complete 
e05ad70678a5: Pull complete 
7feff7652c69: Pull complete 
Digest: sha256:778d2aed25eb85ec40548addb582cbffd0ca6fe5d2a382cb7f3a8958c1ed50d6
Status: Downloaded newer image for ubuntu:latest


docker run -t -i ubuntu /bin/bash
FATAL: kernel too old
jail: /bin/bash: failed

uname -a
FreeBSD 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r335760: Thu Jun 28 15:10:28 UTC 2018     root@releng3.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64
Comment 8 Ting-Wei Lan 2018-07-05 14:45:12 UTC
(In reply to NAMO from comment #7)
Some Linux distributions bumped their Linux version requirement to 3.2 in recent years, so you may want to try older releases which still support Linux 2.6.32.
Comment 9 MacLemon 2018-07-12 00:48:13 UTC
Reproducible to not work on FreeBSD 11.2-RELEASE.

# uname -a
FreeBSD hostname.example.com 11.2-RELEASE FreeBSD 11.2-RELEASE #0 r335510: Fri Jun 22 04:32:14 UTC 2018     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64

```
# docker run hello-world
Error response from daemon: json: cannot set embedded pointer to unexported struct: runconfig.hostConfigWrapper
```

```shell
# docker pull centos
latest: Pulling from centos
29466d114cd8: Extracting [========>                                          ] 12.26 MB/74.69 MB
b298d692482d: Download complete
88ec626ba223: Download complete
Pulling repository centos
Repository not found
```

Best regards
MacLemon
Comment 10 Dmytro Lavryk 2018-07-30 11:25:24 UTC
rebuild port with patch from comment 6 (by Ting-Wei Lan) and it work perfect.

uname -a
FreeBSD XXXXX 10.4-RELEASE-p9 FreeBSD 10.4-RELEASE-p9 #0 r336531: Fri Jul 20 04:36:32 EEST 2018     dl@XXXXX:/usr/obj/usr/src/sys/MAINX  amd64

docker version
Client version: 1.7.0-dev
Client API version: 1.19
Go version (client): go1.10.3
Git commit (client): 582db78
OS/Arch (client): freebsd/amd64
Server version: 1.7.0-dev
Server API version: 1.19
Go version (server): go1.10.3
Git commit (server): 582db78
OS/Arch (server): freebsd/amd64
Comment 11 Matthias Fechner freebsd_committer 2018-08-14 23:34:48 UTC
I tried patch but it does not really help:
docker info
Containers: 1
Images: 8
Storage Driver: zfs
 Zpool: error while getting pool information exit status 1: "/sbin/zpool zpool get all -p zroot" => cannot open '-p': name must begin with a letter

 Zpool Health: not available
 Parent Dataset: zroot/docker
 Space Used By Parent: 114020352
 Space Available: 668433186816
 Parent Quota: no
 Compression: off
Execution Driver: jail
Logging Driver: json-file
Kernel Version: <unknown>
Operating System: <unknown> (error determining if containerized)
CPUs: 2
Total Memory: 0 B
Name: server.idefix.lan
ID: JK4Y:DDUM:3OKP:JHLD:MFLW:YA5Z:2R43:YC3H:2BHK:35QB:WP4B:CI7J
Debug mode (server): true
File Descriptors: -1
Goroutines: 18
System Time: 2018-08-15T01:30:40.09099722+02:00
EventsListeners: 0
Init SHA1:
Init Path: /usr/local/bin/docker
Docker Root Dir: /usr/docker
WARNING: No memory limit support
WARNING: No swap limit support


Try to download centos:
 docker pull centos
latest: Pulling from centos
675ac122cafb: Extracting [========>                                          ] 12.26 MB/74.69 MB
a4875ffe6057: Download complete
c5507be714a7: Download complete
Pulling repository centos
Repository not found

Try to download ubuntu:
docker pull ubuntu
latest: Pulling from ubuntu
6361cc537622: Already exists
f003bda75e7f: Already exists
d08913197ec6: Already exists
c0377ee89d00: Already exists
cf2766246f1c: Already exists
8a21df6e2aba: Already exists
Digest: sha256:8c3cced1211d1a566088c0af049cc8cd6f33f5b275e62e6285ca6a13e66a98f0
Status: Image is up to date for ubuntu:latest

docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu              latest              8a21df6e2aba        2 weeks ago         83.48 MB
hello-world         latest              3535063d9957        4 weeks ago         1.848 kB

docker run -t -i ubuntu /bin/bash
FATAL: kernel too old
jail: /bin/bash: failed
Comment 12 Sanjay 2018-08-20 09:05:41 UTC
I am having FreeBSD11.2 stable. 

FreeBSD bsd11 11.2-RELEASE FreeBSD 11.2-RELEASE #0 r335510: Fri Jun 22 04:32:14 UTC 2018     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64

Getting compilation error post applying  path in comment#6
 ---> Making bundle: binary (in bundles/1.7.0-dev/binary)
Building: /usr/ports/sysutils/docker-freebsd/work/docker-582db78/bundles/1.7.0-dev/binary/docker-1.7.0-dev
# github.com/docker/docker/runconfig
.gopath/src/github.com/docker/docker/runconfig/config.go:135:2: undefined: HostConfigWrapper
*** Error code 2



root@bsd11:/usr/ports/sysutils/docker-freebsd # cat patch-*
--- pkg/system/meminfo_unsupported.go.orig      2015-06-08 19:04:30.000000000 +0530
+++ pkg/system/meminfo_unsupported.go   2018-08-13 18:02:43.017348000 +0530
@@ -3,5 +3,5 @@
 package system

 func ReadMemInfo() (*MemInfo, error) {
-       return nil, ErrNotSupportedPlatform
+      return &MemInfo{}, ErrNotSupportedPlatform
 }
--- runconfig/config.go.orig	2015-06-08 19:04:30.000000000 +0530
+++ runconfig/config.go	2018-08-17 13:37:07.865535000 +0530
@@ -132,15 +132,15 @@ type Config struct {
 
 type ContainerConfigWrapper struct {
 	*Config
-	*hostConfigWrapper
+	*HostConfigWrapper
 }
 
 func (c ContainerConfigWrapper) HostConfig() *HostConfig {
-	if c.hostConfigWrapper == nil {
+	if c.HostConfigWrapper == nil {
 		return new(HostConfig)
 	}
 
-	return c.hostConfigWrapper.GetHostConfig()
+	return c.HostConfigWrapper.GetHostConfig()
 }
 
 func DecodeContainerConfig(src io.Reader) (*Config, *HostConfig, error) {
--- runconfig/hostconfig.go.orig	2018-08-17 14:03:06.712448000 +0530
+++ runconfig/hostconfig.go	2018-08-17 14:05:52.509075000 +0530
@@ -234,7 +234,7 @@ type HostConfig struct {
 func MergeConfigs(config *Config, hostConfig *HostConfig) *ContainerConfigWrapper {
 	return &ContainerConfigWrapper{
 		config,
-		&hostConfigWrapper{InnerHostConfig: hostConfig},
+		&HostConfigWrapper{InnerHostConfig: hostConfig},
 	}
 }
 
@@ -245,7 +245,7 @@ type hostConfigWrapper struct {
 	*HostConfig // Deprecated. Exported to read attrubutes from json that are not in the inner host config structure.
 }
 
-func (w hostConfigWrapper) GetHostConfig() *HostConfig {
+func (w HostConfigWrapper) GetHostConfig() *HostConfig {
 	hc := w.HostConfig
 
 	if hc == nil && w.InnerHostConfig != nil {
@@ -274,7 +274,7 @@ func (w hostConfigWrapper) GetHostConfig
 func DecodeHostConfig(src io.Reader) (*HostConfig, error) {
 	decoder := json.NewDecoder(src)
 
-	var w hostConfigWrapper
+	var w HostConfigWrapper
 	if err := decoder.Decode(&w); err != nil {
 		return nil, err
 	}
Comment 13 Pavel 2018-10-31 09:37:48 UTC
Confirmed working after allying patch from #6 on 12-CURRENT
Comment 14 kappei84 2018-11-28 19:18:46 UTC
Confirmed working after allying patch from #6 on 11-2-RELEASE. However when I run: 

docker run hello-world 

I get:

jail: exec /hello: No such file or directory
jail: /hello: failed

Regards,
Daniele.
Comment 15 Kubilay Kocak freebsd_committer freebsd_triage 2019-01-07 10:51:27 UTC
I have this patch QA'd in my local tree, will commit shortly.

CC new recent maintainer (joneum), see: ports r489312
Comment 16 commit-hook freebsd_committer 2019-01-14 18:09:39 UTC
A commit references this bug:

Author: joneum
Date: Mon Jan 14 18:09:21 UTC 2019
New revision: 490308
URL: https://svnweb.freebsd.org/changeset/ports/490308

Log:
  Add patch to fix an error:

  docker run hello-world
  Error response from daemon: json: cannot set embedded pointer to unexported struct: runconfig.hostConfigWrapper

  PR:		227618
  MFH:		2019Q1
  Sponsored by:	Netzkommune GmbH

Changes:
  head/sysutils/docker-freebsd/Makefile
  head/sysutils/docker-freebsd/files/patch-pkg_system_meminfo__unsupported.go
  head/sysutils/docker-freebsd/files/patch-runconfig_config.go
  head/sysutils/docker-freebsd/files/patch-runconfig_hostconfig.go
Comment 17 commit-hook freebsd_committer 2019-01-15 08:19:14 UTC
A commit references this bug:

Author: joneum
Date: Tue Jan 15 08:18:15 UTC 2019
New revision: 490353
URL: https://svnweb.freebsd.org/changeset/ports/490353

Log:
  MFH: r490308

  Add patch to fix an error:

  docker run hello-world
  Error response from daemon: json: cannot set embedded pointer to unexported struct: runconfig.hostConfigWrapper

  PR:		227618
  Sponsored by:	Netzkommune GmbH

  Approved by:	ports-secteam (miwi)

Changes:
_U  branches/2019Q1/
  branches/2019Q1/sysutils/docker-freebsd/Makefile
  branches/2019Q1/sysutils/docker-freebsd/files/patch-pkg_system_meminfo__unsupported.go
  branches/2019Q1/sysutils/docker-freebsd/files/patch-runconfig_config.go
  branches/2019Q1/sysutils/docker-freebsd/files/patch-runconfig_hostconfig.go