# Need Help With Docker Patch



## SirFixAlot (Nov 19, 2018)

Hi all,

I need help applying a patch. It's my first one.

I ran into a bug/error running the 
`docker run hello-world`
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=227618

At this point I found that a patch was out there... and I think I applied it... but I still get the error.... so maybe I messed  something up...

This is what I did:

citation: Patch files are stored in PATCHDIR, usually files/, from where they will be automatically applied. 

Given this, I changed into the port /files directory, then made the patch file and pasted (from windows machine) the patch content into the file and saved. 

`cd/usr/ports/sysutils/docker/files`
`touch docker-freebsd-go-1.10.patch`
*paste & saved content in the patch file*

At this point I figured I have to recompile the port for the patch to take effect so I found this documentation regarding portmaster.

*4.5.3.2. Upgrading Ports Using Portmaster*

Given this, I then used portmaster to rebuild

`portmaster -r docker-freebsd`

When I try and run
`docker run hello-world`
I still get the error message from the bug link above. Am I applying patches correctly? Am I missing something?

Thanks for all the help!


----------



## ShelLuser (Nov 19, 2018)

What FreeBSD version are you using? Also: which patch did you try, there are a few listed on that thread and some seem to be for a specific version.

Anyway, I doubt that your patch did anything. If you look at all the files in the files directory you'll notice that they all have a *.go* extension, this makes it quite likely that the script uses that extension and will ignore **.patch*.

I might be a little off with that though, because judging from this code snippet it might be more specific:


```
pre-build:                                                                    
                @${MV} ${GO_WRKSRC}/components/* ${GO_WRKSRC}/                
                @${CP} ${FILESDIR}/default_store_freebsd.go \                 
                        ${GO_WRKSRC}/cli/cli/config/credentials/
```
Anyway... I'd apply the patch manually. Run `# make patch` in the port directory to extract the source and have the regular patches applied. You'll notice that you gained a work directory, which is also referred to in the patch (the one I looked at anyway). So then place the patch you downloaded somewhere (not in the files directory!) and apply it manually using the patch(1) command.

You should probably be able to run `patch < patchfile`.

(edit)

Forgot to mention how to proceed: after this run `# make install clean`, do _not_ use portmaster because that will clean the work directory before building (so it would undo your patching). This should be a bit obvious I think but I can well understand if it's a bit confusing at first, so figured I'd added this.


----------



## SirFixAlot (Nov 19, 2018)

Ok... so... still no joy...

I'm on 11.2-RELEASE

The patch I applied came from:

 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.
----------------------------------------------------------------------------

So I did:

`cd /usr/ports/sysutils/docker-freebsd`
`make patch`

I saw the "work" directory appear under /docker-freebsd and next I typed

`touch docker-freebsd-go-1.10.patch`
*copied and pasted and saved the plain text from this link into the new patch file*
https://bugs.freebsd.org/bugzilla/attachment.cgi?id=194534&action=edit


Then I typed
`patch < docker-freebsd-go-1.10.patch`

Then I typed
`docker run hello-world`

Still got the error:

"Error response from daemon: json: cannot set embedded pointer to unexported struct: runconfig.hostConfigWrapper"

Any thoughts? Am I doing something stupid? This is my first attempt at patching...  

Thanks for the help!


----------



## SirFixAlot (Nov 19, 2018)

Just saw your edit, with respect to portmaster. Sorry I missed it before I posted my response. Yes. I did notice that! (cleaning the work directory) So that might have messed me up in the first place... I just saw now however, "make install clean" .... I'm trying this now...


----------



## ShelLuser (Nov 19, 2018)

SirFixAlot said:


> So I did:
> 
> `cd /usr/ports/sysutils/docker-freebsd`
> `make patch`
> ...


That is understandable; the patch only affects the source code so you'll need to build the whole thing again after which it might work. As such don't run docker right away but instead try this command first: `# make deinstall install clean`. This will remove your current installation, rebuild the port (with your patch applied) and then re-install it.

Then you can try again.

oh: and be sure that you didn't got any icky errors when running patch.

(edit)



SirFixAlot said:


> Just saw your edit, with respect to portmaster. Sorry I missed it before I posted my response.


No need, that was my bad anyway   I sometimes forget things and then make quick edits, I can fully understand that those can get overlooked.

Good luck!


----------



## SirFixAlot (Nov 19, 2018)

I was actually just going to post, but I saw now that there is a little link that lets you view updates to the thread. Allowed me to see that I was just about to write the same thing.

Yeah, console was angry at me so I did under /docker-freebsd     (still learning everything)

`make deinstall`
`make install clean`

And then:
`service docker stop`
`service docker start`
`docker run hello-world`

So.... two steps forward and one step back.....
I get the following:

Unable to find image 'hello-world:latest' locally
latest: Pulling from hello-world
74bc6c628z00: Pull complete
19b3f968b60c: Pull complete
Digest: sha256:523e382....
Status: Download newer image for hello-world:latest
jail: exec /hello: No such file or directory
jail: /hello: failed

Any thoughts on this one?


----------

