Signed-off-by: Antonio Murdaca <runcom@redhat.com>
| ... | ... |
@@ -50,6 +50,7 @@ type bridgeConfig struct {
|
| 50 | 50 |
EnableIPForward bool `json:"ip-forward,omitempty"` |
| 51 | 51 |
EnableIPMasq bool `json:"ip-masq,omitempty"` |
| 52 | 52 |
EnableUserlandProxy bool `json:"userland-proxy,omitempty"` |
| 53 |
+ UserlandProxyPath string `json:"userland-proxy-path,omitempty"` |
|
| 53 | 54 |
DefaultIP net.IP `json:"ip,omitempty"` |
| 54 | 55 |
IP string `json:"bip,omitempty"` |
| 55 | 56 |
FixedCIDRv6 string `json:"fixed-cidr-v6,omitempty"` |
| ... | ... |
@@ -84,6 +85,7 @@ func (config *Config) InstallFlags(flags *pflag.FlagSet) {
|
| 84 | 84 |
flags.BoolVar(&config.bridgeConfig.InterContainerCommunication, "icc", true, "Enable inter-container communication") |
| 85 | 85 |
flags.Var(opts.NewIPOpt(&config.bridgeConfig.DefaultIP, "0.0.0.0"), "ip", "Default IP when binding container ports") |
| 86 | 86 |
flags.BoolVar(&config.bridgeConfig.EnableUserlandProxy, "userland-proxy", true, "Use userland proxy for loopback traffic") |
| 87 |
+ flags.StringVar(&config.bridgeConfig.UserlandProxyPath, "userland-proxy-path", "", "Path to the userland proxy binary") |
|
| 87 | 88 |
flags.BoolVar(&config.EnableCors, "api-enable-cors", false, "Enable CORS headers in the remote API, this is deprecated by --api-cors-header") |
| 88 | 89 |
flags.MarkDeprecated("api-enable-cors", "Please use --api-cors-header")
|
| 89 | 90 |
flags.StringVar(&config.CgroupParent, "cgroup-parent", "", "Set parent cgroup for all containers") |
| ... | ... |
@@ -651,7 +651,8 @@ func driverOptions(config *Config) []nwconfig.Option {
|
| 651 | 651 |
bridgeConfig := options.Generic{
|
| 652 | 652 |
"EnableIPForwarding": config.bridgeConfig.EnableIPForward, |
| 653 | 653 |
"EnableIPTables": config.bridgeConfig.EnableIPTables, |
| 654 |
- "EnableUserlandProxy": config.bridgeConfig.EnableUserlandProxy} |
|
| 654 |
+ "EnableUserlandProxy": config.bridgeConfig.EnableUserlandProxy, |
|
| 655 |
+ "UserlandProxyPath": config.bridgeConfig.UserlandProxyPath} |
|
| 655 | 656 |
bridgeOption := options.Generic{netlabel.GenericData: bridgeConfig}
|
| 656 | 657 |
|
| 657 | 658 |
dOptions := []nwconfig.Option{}
|
| ... | ... |
@@ -146,6 +146,9 @@ For example, to install the binaries in `/usr/bin`: |
| 146 | 146 |
$ mv docker/* /usr/bin/ |
| 147 | 147 |
``` |
| 148 | 148 |
|
| 149 |
+> **Note**: Depending on your current setup, you can specify custom paths |
|
| 150 |
+> for some of the binaries provided. |
|
| 151 |
+ |
|
| 149 | 152 |
> **Note**: If you already have Engine installed on your host, make sure you |
| 150 | 153 |
> stop Engine before installing (`killall docker`), and install the binaries |
| 151 | 154 |
> in the same location. You can find the location of the current installation |
| ... | ... |
@@ -78,6 +78,7 @@ Options: |
| 78 | 78 |
--tlskey=~/.docker/key.pem Path to TLS key file |
| 79 | 79 |
--tlsverify Use TLS and verify the remote |
| 80 | 80 |
--userland-proxy=true Use userland proxy for loopback traffic |
| 81 |
+ --userland-proxy-path="" Path to the userland proxy binary |
|
| 81 | 82 |
--userns-remap User/Group setting for user namespaces |
| 82 | 83 |
-v, --version Print version information and quit |
| 83 | 84 |
``` |
| ... | ... |
@@ -1149,6 +1150,7 @@ This is a full example of the allowed configuration options on Linux: |
| 1149 | 1149 |
"ip-forward": false, |
| 1150 | 1150 |
"ip-masq": false, |
| 1151 | 1151 |
"userland-proxy": false, |
| 1152 |
+ "userland-proxy-path": "/usr/libexec/docker-proxy", |
|
| 1152 | 1153 |
"ip": "0.0.0.0", |
| 1153 | 1154 |
"bridge": "", |
| 1154 | 1155 |
"bip": "", |
| ... | ... |
@@ -2872,3 +2872,33 @@ func (s *DockerDaemonSuite) TestDaemonBackcompatPre17Volumes(c *check.C) {
|
| 2872 | 2872 |
c.Assert(matched, checker.True, check.Commentf("did find match for %+v", m))
|
| 2873 | 2873 |
} |
| 2874 | 2874 |
} |
| 2875 |
+ |
|
| 2876 |
+func (s *DockerDaemonSuite) TestDaemonWithUserlandProxyPath(c *check.C) {
|
|
| 2877 |
+ testRequires(c, SameHostDaemon, DaemonIsLinux) |
|
| 2878 |
+ |
|
| 2879 |
+ dockerProxyPath, err := exec.LookPath("docker-proxy")
|
|
| 2880 |
+ c.Assert(err, checker.IsNil) |
|
| 2881 |
+ tmpDir, err := ioutil.TempDir("", "test-docker-proxy")
|
|
| 2882 |
+ c.Assert(err, checker.IsNil) |
|
| 2883 |
+ |
|
| 2884 |
+ newProxyPath := filepath.Join(tmpDir, "docker-proxy") |
|
| 2885 |
+ cmd := exec.Command("cp", dockerProxyPath, newProxyPath)
|
|
| 2886 |
+ c.Assert(cmd.Run(), checker.IsNil) |
|
| 2887 |
+ |
|
| 2888 |
+ // custom one |
|
| 2889 |
+ c.Assert(s.d.StartWithBusybox("--userland-proxy-path", newProxyPath), checker.IsNil)
|
|
| 2890 |
+ out, err := s.d.Cmd("run", "-p", "5000:5000", "busybox:latest", "true")
|
|
| 2891 |
+ c.Assert(err, checker.IsNil, check.Commentf(out)) |
|
| 2892 |
+ |
|
| 2893 |
+ // try with the original one |
|
| 2894 |
+ c.Assert(s.d.Restart("--userland-proxy-path", dockerProxyPath), checker.IsNil)
|
|
| 2895 |
+ out, err = s.d.Cmd("run", "-p", "5000:5000", "busybox:latest", "true")
|
|
| 2896 |
+ c.Assert(err, checker.IsNil, check.Commentf(out)) |
|
| 2897 |
+ |
|
| 2898 |
+ // not exist |
|
| 2899 |
+ c.Assert(s.d.Restart("--userland-proxy-path", "/does/not/exist"), checker.IsNil)
|
|
| 2900 |
+ out, err = s.d.Cmd("run", "-p", "5000:5000", "busybox:latest", "true")
|
|
| 2901 |
+ c.Assert(err, checker.NotNil, check.Commentf(out)) |
|
| 2902 |
+ c.Assert(out, checker.Contains, "driver failed programming external connectivity on endpoint") |
|
| 2903 |
+ c.Assert(out, checker.Contains, "/does/not/exist: no such file or directory") |
|
| 2904 |
+} |
| ... | ... |
@@ -64,6 +64,7 @@ dockerd - Enable daemon mode |
| 64 | 64 |
[**--tlskey**[=*~/.docker/key.pem*]] |
| 65 | 65 |
[**--tlsverify**] |
| 66 | 66 |
[**--userland-proxy**[=*true*]] |
| 67 |
+[**--userland-proxy-path**[=*""*]] |
|
| 67 | 68 |
[**--userns-remap**[=*default*]] |
| 68 | 69 |
|
| 69 | 70 |
# DESCRIPTION |
| ... | ... |
@@ -272,6 +273,9 @@ output otherwise. |
| 272 | 272 |
**--userland-proxy**=*true*|*false* |
| 273 | 273 |
Rely on a userland proxy implementation for inter-container and outside-to-container loopback communications. Default is true. |
| 274 | 274 |
|
| 275 |
+**--userland-proxy-path**="" |
|
| 276 |
+ Path to the userland proxy binary. |
|
| 277 |
+ |
|
| 275 | 278 |
**--userns-remap**=*default*|*uid:gid*|*user:group*|*user*|*uid* |
| 276 | 279 |
Enable user namespaces for containers on the daemon. Specifying "default" will cause a new user and group to be created to handle UID and GID range remapping for the user namespace mappings used for contained processes. Specifying a user (or uid) and optionally a group (or gid) will cause the daemon to lookup the user and group's subordinate ID ranges for use as the user namespace mappings for contained processes. |
| 277 | 280 |
|