Demetrio Guilardi
Demetrio Guilardi

Reputation: 325

Docker patch command substitution

I am using a Docker image and it comes with many binaries from busybox. I need the command "patch" to accept the param "-l". But the command that comes with busybox won't allow this param and it will break giving the following exception:

/usr/local # patch -l
patch: unrecognized option: l
BusyBox v1.29.3 (2019-01-24 07:45:07 UTC) multi-call binary.

Usage: patch [OPTIONS] [ORIGFILE [PATCHFILE]]

-p N    Strip N leading components from file names
-i DIFF Read DIFF instead of stdin
-R  Reverse patch
-N  Ignore already applied patches
-E  Remove output files if they become empty
--dry-run   Don't actually change files

Is there any way to substitute the patch command for another one?

Upvotes: 0

Views: 725

Answers (1)

larsks
larsks

Reputation: 312038

Is there any way to substitute the patch command for another one?

Sure, but the mechanism for doing that is going to vary depending on which image you're using.

If you're using an Alpine based image, you can just do this:

apk add --update patch

This will replace the BusyBox version of patch with the full-featured GNU patch binary.

If you're using something else...you'll need to provide additional details in your question.

Upvotes: 1

Related Questions