mirror of
https://github.com/clearlinux/docker.git
synced 2026-08-19 12:16:30 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cc5c79129f |
@@ -4,6 +4,8 @@
|
||||
|
||||
#### Runtime
|
||||
+ Experimental feature: support for out-of-process volume plugins
|
||||
+ Experimental feature: support for out-of-process network plugins
|
||||
* Logging: syslog logging driver is available
|
||||
* The userland proxy can be disabled in favor of hairpin NAT using the daemon’s `--userland-proxy=false` flag
|
||||
* The `exec` command supports the `-u|--user` flag to specify the new process owner
|
||||
+ Default gateway for containers can be specified daemon-wide using the `--default-gateway` and `--default-gateway-v6` flags
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ Want to hack on Docker? Awesome! We have a contributor's guide that explains
|
||||
[setting up a Docker development environment and the contribution
|
||||
process](https://docs.docker.com/project/who-written-for/).
|
||||
|
||||

|
||||

|
||||
|
||||
This page contains information about reporting issues as well as some tips and
|
||||
guidelines useful to experienced open source contributors. Finally, make sure
|
||||
|
||||
@@ -18,7 +18,7 @@ It benefits directly from the experience accumulated over several years
|
||||
of large-scale operation and support of hundreds of thousands of
|
||||
applications and databases.
|
||||
|
||||

|
||||

|
||||
|
||||
## Security Disclosure
|
||||
|
||||
|
||||
@@ -903,7 +903,6 @@ func (s *Server) postContainersCreate(version version.Version, w http.ResponseWr
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
adjustCpuShares(version, hostConfig)
|
||||
|
||||
containerId, warnings, err := s.daemon.ContainerCreate(name, config, hostConfig)
|
||||
if err != nil {
|
||||
|
||||
@@ -8,21 +8,12 @@ import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/daemon"
|
||||
"github.com/docker/docker/pkg/sockets"
|
||||
"github.com/docker/docker/pkg/systemd"
|
||||
"github.com/docker/docker/pkg/version"
|
||||
"github.com/docker/docker/runconfig"
|
||||
"github.com/docker/libnetwork/portallocator"
|
||||
)
|
||||
|
||||
const (
|
||||
// See http://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/tree/kernel/sched/sched.h?id=8cd9234c64c584432f6992fe944ca9e46ca8ea76#n269
|
||||
linuxMinCpuShares = 2
|
||||
linuxMaxCpuShares = 262144
|
||||
)
|
||||
|
||||
// newServer sets up the required serverClosers and does protocol specific checking.
|
||||
func (s *Server) newServer(proto, addr string) ([]serverCloser, error) {
|
||||
var (
|
||||
@@ -105,18 +96,3 @@ func allocateDaemonPort(addr string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func adjustCpuShares(version version.Version, hostConfig *runconfig.HostConfig) {
|
||||
if version.LessThan("1.19") {
|
||||
if hostConfig.CpuShares > 0 {
|
||||
// Handle unsupported CpuShares
|
||||
if hostConfig.CpuShares < linuxMinCpuShares {
|
||||
logrus.Warnf("Changing requested CpuShares of %d to minimum allowed of %d", hostConfig.CpuShares, linuxMinCpuShares)
|
||||
hostConfig.CpuShares = linuxMinCpuShares
|
||||
} else if hostConfig.CpuShares > linuxMaxCpuShares {
|
||||
logrus.Warnf("Changing requested CpuShares of %d to maximum allowed of %d", hostConfig.CpuShares, linuxMaxCpuShares)
|
||||
hostConfig.CpuShares = linuxMaxCpuShares
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
// +build linux
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/pkg/version"
|
||||
"github.com/docker/docker/runconfig"
|
||||
)
|
||||
|
||||
func TestAdjustCpuSharesOldApi(t *testing.T) {
|
||||
apiVersion := version.Version("1.18")
|
||||
hostConfig := &runconfig.HostConfig{
|
||||
CpuShares: linuxMinCpuShares - 1,
|
||||
}
|
||||
adjustCpuShares(apiVersion, hostConfig)
|
||||
if hostConfig.CpuShares != linuxMinCpuShares {
|
||||
t.Errorf("Expected CpuShares to be %d", linuxMinCpuShares)
|
||||
}
|
||||
|
||||
hostConfig.CpuShares = linuxMaxCpuShares + 1
|
||||
adjustCpuShares(apiVersion, hostConfig)
|
||||
if hostConfig.CpuShares != linuxMaxCpuShares {
|
||||
t.Errorf("Expected CpuShares to be %d", linuxMaxCpuShares)
|
||||
}
|
||||
|
||||
hostConfig.CpuShares = 0
|
||||
adjustCpuShares(apiVersion, hostConfig)
|
||||
if hostConfig.CpuShares != 0 {
|
||||
t.Error("Expected CpuShares to be unchanged")
|
||||
}
|
||||
|
||||
hostConfig.CpuShares = 1024
|
||||
adjustCpuShares(apiVersion, hostConfig)
|
||||
if hostConfig.CpuShares != 1024 {
|
||||
t.Error("Expected CpuShares to be unchanged")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAdjustCpuSharesNoAdjustment(t *testing.T) {
|
||||
apiVersion := version.Version("1.19")
|
||||
hostConfig := &runconfig.HostConfig{
|
||||
CpuShares: linuxMinCpuShares - 1,
|
||||
}
|
||||
adjustCpuShares(apiVersion, hostConfig)
|
||||
if hostConfig.CpuShares != linuxMinCpuShares-1 {
|
||||
t.Errorf("Expected CpuShares to be %d", linuxMinCpuShares-1)
|
||||
}
|
||||
|
||||
hostConfig.CpuShares = linuxMaxCpuShares + 1
|
||||
adjustCpuShares(apiVersion, hostConfig)
|
||||
if hostConfig.CpuShares != linuxMaxCpuShares+1 {
|
||||
t.Errorf("Expected CpuShares to be %d", linuxMaxCpuShares+1)
|
||||
}
|
||||
|
||||
hostConfig.CpuShares = 0
|
||||
adjustCpuShares(apiVersion, hostConfig)
|
||||
if hostConfig.CpuShares != 0 {
|
||||
t.Error("Expected CpuShares to be unchanged")
|
||||
}
|
||||
|
||||
hostConfig.CpuShares = 1024
|
||||
adjustCpuShares(apiVersion, hostConfig)
|
||||
if hostConfig.CpuShares != 1024 {
|
||||
t.Error("Expected CpuShares to be unchanged")
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,3 @@ func (s *Server) AcceptConnections(d *daemon.Daemon) {
|
||||
func allocateDaemonPort(addr string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func adjustCpuShares(version version.Version, hostConfig *runconfig.HostConfig) {
|
||||
}
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@ draft = true
|
||||
|
||||
# Docker Documentation
|
||||
|
||||
The source for Docker documentation is in this directory. Our
|
||||
The source for Docker documentation is in this directory under `sources/`. Our
|
||||
documentation uses extended Markdown, as implemented by
|
||||
[MkDocs](http://mkdocs.org). The current release of the Docker documentation
|
||||
resides on [https://docs.docker.com](https://docs.docker.com).
|
||||
@@ -60,7 +60,7 @@ own.
|
||||
release. It also allows docs maintainers to easily cherry-pick your changes
|
||||
into the `docs` release branch.
|
||||
|
||||
4. Modify existing or add new `.md` files to the `docs` directory.
|
||||
4. Modify existing or add new `.md` files to the `docs/sources` directory.
|
||||
|
||||
If you add a new document (`.md`) file, you must also add it to the
|
||||
appropriate section of the `docs/mkdocs.yml` file in this repository.
|
||||
@@ -113,7 +113,7 @@ links that are referenced in the documentation—there should be none.
|
||||
## Style guide
|
||||
|
||||
If you have questions about how to write for Docker's documentation, please see
|
||||
the [style guide](project/doc-style.md). The style guide provides
|
||||
the [style guide](sources/project/doc-style.md). The style guide provides
|
||||
guidance about grammar, syntax, formatting, styling, language, or tone. If
|
||||
something isn't clear in the guide, please submit an issue to let us know or
|
||||
submit a pull request to help us improve it.
|
||||
|
||||
@@ -9,7 +9,7 @@ so my process is
|
||||
|
||||
$ boot2docker ssh
|
||||
$$ git clone https://github.com/docker/docker
|
||||
$$ cd docker/docs/articles/https
|
||||
$$ cd docker/docs/sources/articles/https
|
||||
$$ make cert
|
||||
lots of things to see and manually answer, as openssl wants to be interactive
|
||||
**NOTE:** make sure you enter the hostname (`boot2docker` in my case) when prompted for `Computer Name`)
|
||||
@@ -18,7 +18,7 @@ $$ sudo make run
|
||||
start another terminal
|
||||
|
||||
$ boot2docker ssh
|
||||
$$ cd docker/docs/articles/https
|
||||
$$ cd docker/docs/sources/articles/https
|
||||
$$ make client
|
||||
|
||||
the last will connect first with `--tls` and then with `--tlsverify`
|
||||
|
||||
@@ -83,8 +83,8 @@ To update your existing pull request:
|
||||
# Your branch is up-to-date with 'origin/11038-fix-rhel-link'.
|
||||
#
|
||||
# Changes to be committed:
|
||||
# modified: docs/installation/mac.md
|
||||
# modified: docs/installation/rhel.md
|
||||
# modified: docs/sources/installation/mac.md
|
||||
# modified: docs/sources/installation/rhel.md
|
||||
|
||||
5. Force push the change to your origin.
|
||||
|
||||
|
||||
@@ -274,7 +274,7 @@ make any changes just run these commands again.
|
||||
|
||||
## Build and test the documentation
|
||||
|
||||
The Docker documentation source files are under `docs`. The content is
|
||||
The Docker documentation source files are under `docs/sources`. The content is
|
||||
written using extended Markdown. We use the static generator <a
|
||||
href="http://www.mkdocs.org/" target="_blank">MkDocs</a> to build Docker's
|
||||
documentation. Of course, you don't need to install this generator
|
||||
|
||||
@@ -97,16 +97,16 @@ Follow this workflow as you work:
|
||||
(use "git add <file>..." to update what will be committed)
|
||||
(use "git checkout -- <file>..." to discard changes in working directory)
|
||||
|
||||
modified: docs/installation/mac.md
|
||||
modified: docs/installation/rhel.md
|
||||
modified: docs/sources/installation/mac.md
|
||||
modified: docs/sources/installation/rhel.md
|
||||
|
||||
The `status` command lists what changed in the repository. Make sure you see
|
||||
the changes you expect.
|
||||
|
||||
7. Add your change to Git.
|
||||
|
||||
$ git add docs/installation/mac.md
|
||||
$ git add docs/installation/rhel.md
|
||||
$ git add docs/sources/installation/mac.md
|
||||
$ git add docs/sources/installation/rhel.md
|
||||
|
||||
|
||||
8. Commit your changes making sure you use the `-s` flag to sign your work.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Static files dir
|
||||
================
|
||||
|
||||
Files you put in /static_files/ will be copied to the web visible /_static/
|
||||
Files you put in /sources/static_files/ will be copied to the web visible /_static/
|
||||
|
||||
Be careful not to override pre-existing static files from the template.
|
||||
|
||||
|
||||
@@ -207,8 +207,6 @@ do_install() {
|
||||
$sh_c "apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9"
|
||||
elif [ "https://test.docker.com/" = "$url" ]; then
|
||||
$sh_c "apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 740B314AE3941731B942C66ADF4FD13717AAD7D6"
|
||||
elif [ "https://experimental.docker.com/" = "$url" ]; then
|
||||
$sh_c "apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys E33FF7BF5C91D50A6F91FFFD4CC38D40F9A96B49"
|
||||
else
|
||||
$sh_c "$curl ${url}gpg | apt-key add -"
|
||||
fi
|
||||
|
||||
@@ -284,8 +284,6 @@ EOF
|
||||
local gpgFingerprint=36A1D7869245C8950F966E92D8576A8BA88D21E9
|
||||
if [[ $BUCKET == test* ]]; then
|
||||
gpgFingerprint=740B314AE3941731B942C66ADF4FD13717AAD7D6
|
||||
elif [[ $BUCKET == experimental* ]]; then
|
||||
gpgFingerprint=E33FF7BF5C91D50A6F91FFFD4CC38D40F9A96B49
|
||||
fi
|
||||
|
||||
# Upload repo
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ clone hg code.google.com/p/go.net 84a4013f96e0
|
||||
clone hg code.google.com/p/gosqlite 74691fb6f837
|
||||
|
||||
#get libnetwork packages
|
||||
clone git github.com/docker/libnetwork b116b5c0d20ee4021297fa92b7db4429a622c044
|
||||
clone git github.com/docker/libnetwork e578e95aa101441481411ff1d620f343895f24fe
|
||||
clone git github.com/vishvananda/netns 5478c060110032f972e86a1f844fdb9a2f008f2c
|
||||
clone git github.com/vishvananda/netlink 8eb64238879fed52fd51c5b30ad20b928fb4c36c
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ We don't want to stop contributions to master just because we are releasing. At
|
||||
the same time, now that the release branch exists, we don't want API changes to
|
||||
go to the now frozen API version.
|
||||
|
||||
Create a new entry in `docs/reference/api/` by copying the latest and
|
||||
Create a new entry in `docs/sources/reference/api/` by copying the latest and
|
||||
bumping the version number (in both the file's name and content), and submit
|
||||
this in a PR against master.
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/libnetwork/driverapi"
|
||||
"github.com/docker/libnetwork/ipallocator"
|
||||
"github.com/docker/libnetwork/iptables"
|
||||
"github.com/docker/libnetwork/netlabel"
|
||||
"github.com/docker/libnetwork/netutils"
|
||||
"github.com/docker/libnetwork/options"
|
||||
@@ -110,9 +109,6 @@ func Init(dc driverapi.DriverCallback) error {
|
||||
if out, err := exec.Command("modprobe", "-va", "bridge", "nf_nat", "br_netfilter").Output(); err != nil {
|
||||
logrus.Warnf("Running modprobe bridge nf_nat failed with message: %s, error: %v", out, err)
|
||||
}
|
||||
if err := iptables.RemoveExistingChain(DockerChain, iptables.Nat); err != nil {
|
||||
logrus.Warnf("Failed to remove existing iptables entries in %s : %v", DockerChain, err)
|
||||
}
|
||||
|
||||
return dc.RegisterDriver(networkType, newDriver())
|
||||
}
|
||||
|
||||
@@ -99,8 +99,7 @@ func NewChain(name, bridge string, table Table, hairpinMode bool) (*Chain, error
|
||||
case Nat:
|
||||
preroute := []string{
|
||||
"-m", "addrtype",
|
||||
"--dst-type", "LOCAL",
|
||||
"-j", c.Name}
|
||||
"--dst-type", "LOCAL"}
|
||||
if !Exists(Nat, "PREROUTING", preroute...) {
|
||||
if err := c.Prerouting(Append, preroute...); err != nil {
|
||||
return nil, fmt.Errorf("Failed to inject docker in PREROUTING chain: %s", err)
|
||||
@@ -108,8 +107,7 @@ func NewChain(name, bridge string, table Table, hairpinMode bool) (*Chain, error
|
||||
}
|
||||
output := []string{
|
||||
"-m", "addrtype",
|
||||
"--dst-type", "LOCAL",
|
||||
"-j", c.Name}
|
||||
"--dst-type", "LOCAL"}
|
||||
if !hairpinMode {
|
||||
output = append(output, "!", "--dst", "127.0.0.0/8")
|
||||
}
|
||||
@@ -230,7 +228,7 @@ func (c *Chain) Prerouting(action Action, args ...string) error {
|
||||
if len(args) > 0 {
|
||||
a = append(a, args...)
|
||||
}
|
||||
if output, err := Raw(a...); err != nil {
|
||||
if output, err := Raw(append(a, "-j", c.Name)...); err != nil {
|
||||
return err
|
||||
} else if len(output) != 0 {
|
||||
return ChainError{Chain: "PREROUTING", Output: output}
|
||||
@@ -244,7 +242,7 @@ func (c *Chain) Output(action Action, args ...string) error {
|
||||
if len(args) > 0 {
|
||||
a = append(a, args...)
|
||||
}
|
||||
if output, err := Raw(a...); err != nil {
|
||||
if output, err := Raw(append(a, "-j", c.Name)...); err != nil {
|
||||
return err
|
||||
} else if len(output) != 0 {
|
||||
return ChainError{Chain: "OUTPUT", Output: output}
|
||||
@@ -256,9 +254,9 @@ func (c *Chain) Output(action Action, args ...string) error {
|
||||
func (c *Chain) Remove() error {
|
||||
// Ignore errors - This could mean the chains were never set up
|
||||
if c.Table == Nat {
|
||||
c.Prerouting(Delete, "-m", "addrtype", "--dst-type", "LOCAL", "-j", c.Name)
|
||||
c.Output(Delete, "-m", "addrtype", "--dst-type", "LOCAL", "!", "--dst", "127.0.0.0/8", "-j", c.Name)
|
||||
c.Output(Delete, "-m", "addrtype", "--dst-type", "LOCAL", "-j", c.Name) // Created in versions <= 0.1.6
|
||||
c.Prerouting(Delete, "-m", "addrtype", "--dst-type", "LOCAL")
|
||||
c.Output(Delete, "-m", "addrtype", "--dst-type", "LOCAL", "!", "--dst", "127.0.0.0/8")
|
||||
c.Output(Delete, "-m", "addrtype", "--dst-type", "LOCAL") // Created in versions <= 0.1.6
|
||||
|
||||
c.Prerouting(Delete)
|
||||
c.Output(Delete)
|
||||
|
||||
@@ -48,7 +48,6 @@ func TestForward(t *testing.T) {
|
||||
"--dport", strconv.Itoa(port),
|
||||
"-j", "DNAT",
|
||||
"--to-destination", dstAddr + ":" + strconv.Itoa(dstPort),
|
||||
"!", "-i", natChain.Bridge,
|
||||
}
|
||||
|
||||
if !Exists(natChain.Table, natChain.Name, dnatRule...) {
|
||||
@@ -131,11 +130,16 @@ func TestPrerouting(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if !Exists(natChain.Table, "PREROUTING", args...) {
|
||||
rule := []string{
|
||||
"-j", natChain.Name}
|
||||
|
||||
rule = append(rule, args...)
|
||||
|
||||
if !Exists(natChain.Table, "PREROUTING", rule...) {
|
||||
t.Fatalf("rule does not exist")
|
||||
}
|
||||
|
||||
delRule := append([]string{"-D", "PREROUTING", "-t", string(Nat)}, args...)
|
||||
delRule := append([]string{"-D", "PREROUTING", "-t", string(Nat)}, rule...)
|
||||
if _, err = Raw(delRule...); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -151,12 +155,17 @@ func TestOutput(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if !Exists(natChain.Table, "OUTPUT", args...) {
|
||||
rule := []string{
|
||||
"-j", natChain.Name}
|
||||
|
||||
rule = append(rule, args...)
|
||||
|
||||
if !Exists(natChain.Table, "OUTPUT", rule...) {
|
||||
t.Fatalf("rule does not exist")
|
||||
}
|
||||
|
||||
delRule := append([]string{"-D", "OUTPUT", "-t",
|
||||
string(natChain.Table)}, args...)
|
||||
string(natChain.Table)}, rule...)
|
||||
if _, err = Raw(delRule...); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user