From f248a8e13cbde9498a79a902c3d326bf2021e181 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Thu, 17 Oct 2013 11:27:44 -0700 Subject: [PATCH 01/10] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ddd8580a10..b81e0d7706 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 0.6.4 (2013-10-15) +## 0.6.4 (2013-10-16) - Runtime: Add cleanup of container when Start() fails - Testing: Catch errClosing error when TCP and UDP proxies are terminated - Testing: Add aggregated docker-ci email report From da054148dc17c869c6b7958d48d3abc9fe1cdcf9 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Tue, 29 Oct 2013 14:42:20 -0700 Subject: [PATCH 02/10] Bump to version 0.6.5 --- CHANGELOG.md | 29 +++++++++++++++++++++++++++++ VERSION | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b81e0d7706..ff6c9bc9fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,34 @@ # Changelog +## 0.6.5 (2013-10-29) ++ Runtime: Containers can now be named ++ Runtime: Containers can now be linked together for service discovery ++ Runtime: 'run -a', 'start -a' and 'attach' can forward signals to the container for better integration with process supervisors ++ Runtime: Automatically start crashed containers after a reboot ++ Runtime: Expose IP, port, and proto as separate environment vars for container links +* Runtime: Allow ports to be published to specific ips +* Runtime: Prohibit inter-container communication by default +* Documentation: Fix the flags for nc in example +- Client: Only pass stdin to hijack when needed to avoid closed pipe errors +* Testing: Remove warnings and prevent mount issues +* Client: Use less reflection in command-line method invocation +- Runtime: Ignore ErrClosedPipe for stdin in Container.Attach +- Testing: Change logic for tty resize to avoid warning in tests +- Client: Monitor the tty size after starting the container, not prior +- Hack: Update install.sh with $sh_c to get sudo/su for modprobe +- Client: Remove useless os.Exit() calls after log.Fatal +* Hack: Update all the mkimage scripts to use --numeric-owner as a tar argument +* Hack: Update hack/release.sh process to automatically invoke hack/make.sh and bail on build and test issues ++ Hack: Add initial init scripts library and a safer Ubuntu packaging script that works for Debian +- Runtime: Fix untag during removal of images +- Runtime: Remove unused field kernelVersion +* Hack: Add -p option to invoke debootstrap with http_proxy +- Builder: Fix race condition in docker build with verbose output +- Registry: Fix content-type for PushImageJSONIndex method +* Runtime: Fix issue when mounting subdirectories of /mnt in container +* Runtime: Check return value of syscall.Chdir when changing working directory inside dockerinit +* Contrib: Improve helper tools to generate debian and Arch linux server images + ## 0.6.4 (2013-10-16) - Runtime: Add cleanup of container when Start() fails - Testing: Catch errClosing error when TCP and UDP proxies are terminated diff --git a/VERSION b/VERSION index ba6a53c9ac..ef5e445445 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.6.4-dev +0.6.5 From 79bf2c2b0e898fdc93db66ddc1622bb79c0b83f8 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Wed, 30 Oct 2013 08:15:12 -0700 Subject: [PATCH 03/10] Hotfix: Migrate public mappings after upgrade --- container.go | 5 ++++- utils.go | 12 ++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/container.go b/container.go index 43792d5f00..1888e91ff9 100644 --- a/container.go +++ b/container.go @@ -1054,10 +1054,13 @@ func (container *Container) allocateNetwork(hostConfig *HostConfig) error { if container.Config.PortSpecs != nil { utils.Debugf("Migrating port mappings for container: %s", strings.Join(container.Config.PortSpecs, ", ")) - if err := migratePortMappings(container.Config); err != nil { + if err := migratePortMappings(container.Config, hostConfig); err != nil { return err } container.Config.PortSpecs = nil + if err := container.SaveHostConfig(hostConfig); err != nil { + return err + } } portSpecs := make(map[Port]struct{}) diff --git a/utils.go b/utils.go index cffee05615..8043b16d47 100644 --- a/utils.go +++ b/utils.go @@ -265,15 +265,19 @@ func parsePort(rawPort string) (int, error) { return int(port), nil } -func migratePortMappings(config *Config) error { +func migratePortMappings(config *Config, hostConfig *HostConfig) error { if config.PortSpecs != nil { - // We don't have to worry about migrating the bindings to the host - // This is our breaking change - ports, _, err := parsePortSpecs(config.PortSpecs) + ports, bindings, err := parsePortSpecs(config.PortSpecs) if err != nil { return err } config.PortSpecs = nil + if len(bindings) > 0 { + if hostConfig == nil { + hostConfig = &HostConfig{} + } + hostConfig.PortBindings = bindings + } if config.ExposedPorts == nil { config.ExposedPorts = make(map[Port]struct{}, len(ports)) From 5fb6d6e47c41d7ca3eda71ef6fd9dab824b1daa1 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Wed, 30 Oct 2013 11:13:10 -0700 Subject: [PATCH 04/10] continue build on expose with :, but displays a warning --- buildfile.go | 8 ++++---- runtime.go | 20 +++++++++----------- runtime_test.go | 15 +++++++++++++++ 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/buildfile.go b/buildfile.go index effad01ef0..931395efec 100644 --- a/buildfile.go +++ b/buildfile.go @@ -187,9 +187,6 @@ func (b *buildFile) CmdCmd(args string) error { } func (b *buildFile) CmdExpose(args string) error { - if strings.Contains(args, ":") { - return fmt.Errorf("EXPOSE cannot be used to bind to a host ip or port") - } ports := strings.Split(args, " ") b.config.PortSpecs = append(ports, b.config.PortSpecs...) return b.commit("", b.config.Cmd, fmt.Sprintf("EXPOSE %v", ports)) @@ -433,10 +430,13 @@ func (b *buildFile) commit(id string, autoCmd []string, comment string) error { } } - container, _, err := b.runtime.Create(b.config, "") + container, warnings, err := b.runtime.Create(b.config, "") if err != nil { return err } + for _, warning := range warnings { + fmt.Fprintf(b.out, " ---> [Warning] %s\n", warning) + } b.tmpContainers[container.ID] = struct{}{} fmt.Fprintf(b.out, " ---> Running in %s\n", utils.TruncateID(container.ID)) id = container.ID diff --git a/runtime.go b/runtime.go index e5c535f9fc..097a74a1f4 100644 --- a/runtime.go +++ b/runtime.go @@ -317,22 +317,20 @@ func (runtime *Runtime) Create(config *Config, name string) (*Container, []strin return nil, nil, err } - warnings := []string{} if img.Config != nil { - if img.Config.PortSpecs != nil && warnings != nil { - for _, p := range img.Config.PortSpecs { - if strings.Contains(p, ":") { - warnings = append(warnings, "This image expects private ports to be mapped to public ports on your host. "+ - "This has been deprecated and the public mappings will not be honored."+ - "Use -p to publish the ports.") - break - } - } - } if err := MergeConfig(config, img.Config); err != nil { return nil, nil, err } } + warnings := []string{} + if config.PortSpecs != nil { + for _, p := range config.PortSpecs { + if strings.Contains(p, ":") { + warnings = append(warnings, "The mapping to a public ports on your host has been deprecated. Use -p to publish the ports.") + break + } + } + } if len(config.Entrypoint) != 0 && config.Cmd == nil { config.Cmd = []string{} diff --git a/runtime_test.go b/runtime_test.go index c7cea75616..21e229b4c8 100644 --- a/runtime_test.go +++ b/runtime_test.go @@ -260,6 +260,21 @@ func TestRuntimeCreate(t *testing.T) { if err != nil { t.Error(err) } + + // test expose 80:8000 + container, warnings, err := runtime.Create(&Config{ + Image: GetTestImage(runtime).ID, + Cmd: []string{"ls", "-al"}, + PortSpecs: []string{"80:8000"}, + }, + "", + ) + if err != nil { + t.Fatal(err) + } + if warnings == nil { + t.Error("Expected a warning, got none") + } } func TestDestroy(t *testing.T) { From 6a9fb81c5794166fc62e8fc5c638127d69f13eee Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Wed, 30 Oct 2013 11:24:50 -0700 Subject: [PATCH 05/10] improve error message --- runtime.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime.go b/runtime.go index 097a74a1f4..0834dd668a 100644 --- a/runtime.go +++ b/runtime.go @@ -355,6 +355,9 @@ func (runtime *Runtime) Create(config *Config, name string) (*Container, []strin // Set the enitity in the graph using the default name specified if _, err := runtime.containerGraph.Set(name, id); err != nil { + if strings.HasSuffix(err.Error(), "name are not unique") { + return nil, nil, fmt.Errorf("Conflict, %s already exists.", name) + } return nil, nil, err } From 4fd389eee5675479e9f3414d79ac38f1ebcd0428 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Wed, 30 Oct 2013 11:45:11 -0700 Subject: [PATCH 06/10] fix remove root name and fix error messages --- links.go | 2 +- server.go | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/links.go b/links.go index 827934a41d..60c738abb4 100644 --- a/links.go +++ b/links.go @@ -22,7 +22,7 @@ func NewLink(parent, child *Container, name, bridgeInterface string) (*Link, err return nil, fmt.Errorf("Cannot link to self: %s == %s", parent.ID, child.ID) } if !child.State.Running { - return nil, fmt.Errorf("Cannot link to a non running container: %s AS %s", child.ID, name) + return nil, fmt.Errorf("Cannot link to a non running container: %s AS %s", child.Name, name) } ports := make([]Port, len(child.Config.ExposedPorts)) diff --git a/server.go b/server.go index 2cb6771178..f87b1e8ac0 100644 --- a/server.go +++ b/server.go @@ -84,13 +84,13 @@ func (srv *Server) ContainerKill(name string, sig int) error { // If no signal is passed, perform regular Kill (SIGKILL + wait()) if sig == 0 { if err := container.Kill(); err != nil { - return fmt.Errorf("Error killing container %s: %s", name, err) + return fmt.Errorf("Cannot kill container %s: %s", name, err) } srv.LogEvent("kill", container.ShortID(), srv.runtime.repositories.ImageName(container.Image)) } else { // Otherwise, just send the requested signal if err := container.kill(sig); err != nil { - return fmt.Errorf("Error killing container %s: %s", name, err) + return fmt.Errorf("Cannot kil container %s: %s", name, err) } // FIXME: Add event for signals } @@ -187,7 +187,7 @@ func (srv *Server) ImagesViz(out io.Writer) error { for _, image := range images { parentImage, err = image.GetParent() if err != nil { - return fmt.Errorf("Error while getting parent image: %v", err) + return err } if parentImage != nil { out.Write([]byte(" \"" + parentImage.ShortID() + "\" -> \"" + image.ShortID() + "\"\n")) @@ -335,7 +335,7 @@ func (srv *Server) ContainerTop(name, ps_args string) (*APITop, error) { if container := srv.runtime.Get(name); container != nil { output, err := exec.Command("lxc-ps", "--name", container.ID, "--", ps_args).CombinedOutput() if err != nil { - return nil, fmt.Errorf("Error trying to use lxc-ps: %s (%s)", err, output) + return nil, fmt.Errorf("lxc-ps: %s (%s)", err, output) } procs := APITop{} for i, line := range strings.Split(string(output), "\n") { @@ -346,7 +346,7 @@ func (srv *Server) ContainerTop(name, ps_args string) (*APITop, error) { scanner := bufio.NewScanner(strings.NewReader(line)) scanner.Split(bufio.ScanWords) if !scanner.Scan() { - return nil, fmt.Errorf("Error trying to use lxc-ps") + return nil, fmt.Errorf("Wrong output using lxc-ps") } // no scanner.Text because we skip container id for scanner.Scan() { @@ -819,7 +819,7 @@ func (srv *Server) pushImage(r *registry.Registry, out io.Writer, remote, imgID, out = utils.NewWriteFlusher(out) jsonRaw, err := ioutil.ReadFile(path.Join(srv.runtime.graph.Root, imgID, "json")) if err != nil { - return "", fmt.Errorf("Error while retrieving the path for {%s}: %s", imgID, err) + return "", fmt.Errorf("Cannot retrieve the path for {%s}: %s", imgID, err) } out.Write(sf.FormatStatus("", "Pushing %s", imgID)) @@ -969,7 +969,7 @@ func (srv *Server) ContainerCreate(config *Config, name string) (string, []strin func (srv *Server) ContainerRestart(name string, t int) error { if container := srv.runtime.Get(name); container != nil { if err := container.Restart(t); err != nil { - return fmt.Errorf("Error restarting container %s: %s", name, err) + return fmt.Errorf("Cannot restart container %s: %s", name, err) } srv.LogEvent("restart", container.ShortID(), srv.runtime.repositories.ImageName(container.Image)) } else { @@ -986,9 +986,10 @@ func (srv *Server) ContainerDestroy(name string, removeVolume, removeLink bool) return fmt.Errorf("No such link: %s", name) } name = srv.runtime.getFullName(name) - parent, n := path.Split(name) - + if parent == "/" { + return fmt.Errorf("Conflict, cannot remove the default name of the container") + } pe := srv.runtime.containerGraph.Get(parent) if pe == nil { return fmt.Errorf("Cannot get parent %s for name %s", parent, name) @@ -1021,7 +1022,7 @@ func (srv *Server) ContainerDestroy(name string, removeVolume, removeLink bool) volumes[volumeId] = struct{}{} } if err := srv.runtime.Destroy(container); err != nil { - return fmt.Errorf("Error destroying container %s: %s", name, err) + return fmt.Errorf("Cannot destroy container %s: %s", name, err) } srv.LogEvent("destroy", container.ShortID(), srv.runtime.repositories.ImageName(container.Image)) @@ -1165,7 +1166,7 @@ func (srv *Server) ImageDelete(name string, autoPrune bool) ([]APIRmi, error) { } if !autoPrune { if err := srv.runtime.graph.Delete(img.ID); err != nil { - return nil, fmt.Errorf("Error deleting image %s: %s", name, err) + return nil, fmt.Errorf("Cannot delete image %s: %s", name, err) } return nil, nil } @@ -1252,7 +1253,7 @@ func (srv *Server) ContainerStart(name string, hostConfig *HostConfig) error { } if err := container.Start(hostConfig); err != nil { - return fmt.Errorf("Error starting container %s: %s", name, err) + return fmt.Errorf("Cannot start container %s: %s", name, err) } srv.LogEvent("start", container.ShortID(), runtime.repositories.ImageName(container.Image)) @@ -1262,7 +1263,7 @@ func (srv *Server) ContainerStart(name string, hostConfig *HostConfig) error { func (srv *Server) ContainerStop(name string, t int) error { if container := srv.runtime.Get(name); container != nil { if err := container.Stop(t); err != nil { - return fmt.Errorf("Error stopping container %s: %s", name, err) + return fmt.Errorf("Cannot stop container %s: %s", name, err) } srv.LogEvent("stop", container.ShortID(), srv.runtime.repositories.ImageName(container.Image)) } else { From 596facd1240036c91dd9579991aeb89f9f81f6eb Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Wed, 30 Oct 2013 13:18:48 -0700 Subject: [PATCH 07/10] fix typos --- runtime.go | 2 +- runtime_test.go | 2 +- server.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime.go b/runtime.go index 0834dd668a..d9f5b41590 100644 --- a/runtime.go +++ b/runtime.go @@ -326,7 +326,7 @@ func (runtime *Runtime) Create(config *Config, name string) (*Container, []strin if config.PortSpecs != nil { for _, p := range config.PortSpecs { if strings.Contains(p, ":") { - warnings = append(warnings, "The mapping to a public ports on your host has been deprecated. Use -p to publish the ports.") + warnings = append(warnings, "The mapping to public ports on your host has been deprecated. Use -p to publish the ports.") break } } diff --git a/runtime_test.go b/runtime_test.go index 21e229b4c8..858481cb40 100644 --- a/runtime_test.go +++ b/runtime_test.go @@ -272,7 +272,7 @@ func TestRuntimeCreate(t *testing.T) { if err != nil { t.Fatal(err) } - if warnings == nil { + if warnings == nil || len(warnings) != 1 { t.Error("Expected a warning, got none") } } diff --git a/server.go b/server.go index f87b1e8ac0..d9e5bc0295 100644 --- a/server.go +++ b/server.go @@ -90,7 +90,7 @@ func (srv *Server) ContainerKill(name string, sig int) error { } else { // Otherwise, just send the requested signal if err := container.kill(sig); err != nil { - return fmt.Errorf("Cannot kil container %s: %s", name, err) + return fmt.Errorf("Cannot kill container %s: %s", name, err) } // FIXME: Add event for signals } From 1edde0e8a38bfb50fc5d2ccc76a4659422a856c4 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Wed, 30 Oct 2013 11:59:05 -0700 Subject: [PATCH 08/10] Update links and host integration documentation --- docs/sources/examples/linking_into_redis.rst | 50 ++++---- docs/sources/use/host_integration.rst | 124 +++++-------------- 2 files changed, 57 insertions(+), 117 deletions(-) diff --git a/docs/sources/examples/linking_into_redis.rst b/docs/sources/examples/linking_into_redis.rst index a0341ad18f..ccbdf57c07 100644 --- a/docs/sources/examples/linking_into_redis.rst +++ b/docs/sources/examples/linking_into_redis.rst @@ -14,12 +14,16 @@ Building a redis container to link as a child of our web application. Building the redis container ---------------------------- -We will use a pre-build version of redis from the index under -the name ``crosbymichael/redis``. If you are interested in the -Dockerfile that was used to build this container here it is. +Lets build a redis image with the following Dockerfile. .. code-block:: bash - + + git clone https://github.com/antirez/redis.git + cd redis + git checkout 2.6 + + # Save this Dockerfile to the root of the redis repository. + # Build redis from source # Make sure you have the redis source code checked out in # the same directory as this Dockerfile @@ -34,7 +38,6 @@ Dockerfile that was used to build this container here it is. ADD . /redis RUN (cd /redis && make) - RUN (cd /redis && make test) RUN mkdir -p /redis-data VOLUME ["/redis-data"] @@ -43,6 +46,9 @@ Dockerfile that was used to build this container here it is. ENTRYPOINT ["/redis/src/redis-server"] CMD ["--dir", "/redis-data"] + # docker build our new redis image from source + docker build -t redis-2.6 . + We need to ``EXPOSE`` the default port of 6379 so that our link knows what ports to connect to our redis container on. If you do not expose any ports for the @@ -54,31 +60,28 @@ Run the redis container .. code-block:: bash - docker run -d -e PASSWORD=docker -name redis crosbymichael/redis --requirepass=docker + docker run -d -e PASSWORD=docker -name redis redis-2.6 --requirepass docker -This will run our redis container using the default port of 6379 and using docker -as password to secure our service. By specifying the ``-name`` flag on run -we will assign the name ``redis`` to this container. -We can issue all the commands that you would expect; start, stop, attach, using the name. -The name also allows us to link other containers into this one. If you do not specify a -name on docker run, docker will automatically generate a name for your container. +This will run our redis container wit the password docker +to secure our service. By specifying the ``-name`` flag on run +we will assign the name ``redis`` to this container. If we do not specify a name for +our container via the ``-name`` flag docker will automatically generate a name for us. +We can issue all the commands that you would expect; start, stop, attach, using the name for our container. +The name also allows us to link other containers into this one. Linking redis as a child ------------------------ Next we can start a new web application that has a dependency on redis and apply a link -to connect both containers. If you noticed when running our redis service we did not use -the ``-p`` option to publish the redis port to the host system. Redis exposed port 6379 -but we did not publish the port. This allows docker to prevent all network traffic to -the redis container except when explicitly specified within a link. This is a big win -for security. - +to connect both containers. If you noticed when running our redis server we did not use +the ``-p`` flag to publish the redis port to the host system. Redis exposed port 6379 via the Dockerfile +and this is all we need to establish a link. Now lets start our web application with a link into redis. .. code-block:: bash - docker run -t -i -link /redis:db -name webapp ubuntu bash + docker run -t -i -link redis:db -name webapp ubuntu bash root@4c01db0b339c:/# env @@ -101,22 +104,25 @@ Now lets start our web application with a link into redis. When we inspect the environment of the linked container we can see a few extra environment -variables have been added. When you specified ``-link /redis:db`` you are telling docker -to link the container named ``/redis`` into this new container with the alias ``db``. +variables have been added. When you specified ``-link redis:db`` you are telling docker +to link the container named ``redis`` into this new container with the alias ``db``. Environment variables are prefixed with the alias so that the parent container can access -network and environment information from the child. +network and environment information from the containers that are linked into it. .. code-block:: bash # The name of the child container DB_NAME=/webapp/db + # The default protocol, ip, and port of the service running in the container DB_PORT=tcp://172.17.0.8:6379 + # A specific protocol, ip, and port of various services DB_PORT_6379_TCP=tcp://172.17.0.8:6379 DB_PORT_6379_TCP_PROTO=tcp DB_PORT_6379_TCP_ADDR=172.17.0.8 DB_PORT_6379_TCP_PORT=6379 + # Get environment variables of the container DB_ENV_PASSWORD=dockerpass diff --git a/docs/sources/use/host_integration.rst b/docs/sources/use/host_integration.rst index c10a79df18..92012df3d6 100644 --- a/docs/sources/use/host_integration.rst +++ b/docs/sources/use/host_integration.rst @@ -13,113 +13,47 @@ You can use your Docker containers with process managers like ``upstart``, Introduction ------------ +If you want a process manager to manage your containers you will need to run +the docker daemon with the ``-r=false`` so that docker will not automatically +restart your containers when the host is restarted. + When you have finished setting up your image and are happy with your running container, you may want to use a process manager to manage -it. To help with this, we provide a simple image: ``creack/manager:min`` +it. When your run ``docker start -a`` docker will automatically attach +to the process and forward all signals so that the process manager can +detect when a container stops and correctly restart it. -This image takes the container ID as parameter. We also can specify -the kind of process manager and metadata like *Author* and -*Description*. The output will will be text suitable for a -configuration file, echoed to stdout. It is up to you to create the -.conf file (for `upstart -`_) or -.service file (for `systemd -`_) and -put it in the right place for your system. +Here are a few sample scripts for systemd and upstart to integrate with docker. -Usage ------ + +Sample Upstart Script +--------------------- .. code-block:: bash - docker run creack/manager:min [OPTIONS] + description "Redis container" + author "Me" + start on filesystem and started lxc-net and started docker + stop on runlevel [!2345] + respawn + exec docker start -a 0a7e070b698b -.. program:: docker run creack/manager:min -.. cmdoption:: -a="" - - Author of the image - -.. cmdoption:: -d="" - - Description of the image - -.. cmdoption:: -t="upstart" - - Type of manager requested: ``upstart`` or ``systemd`` - -Example Output -.............. +Sample systemd Script +--------------------- .. code-block:: bash - docker run creack/manager:min -t="systemd" b28605f2f9a4 - [Unit] - Description= - Author= - After=docker.service + [Unit] + Description=Redis container + Author=Me + After=docker.service - [Service] - Restart=always - ExecStart=/usr/bin/docker start -a b28605f2f9a4 - ExecStop=/usr/bin/docker stop -t 2 b28605f2f9a4 + [Service] + Restart=always + ExecStart=/usr/bin/docker start -a 0a7e070b698b + ExecStop=/usr/bin/docker stop -t 2 0a7e070b698b - [Install] - WantedBy=local.target + [Install] + WantedBy=local.target - - -Development ------------ - -The image ``creack/manager:min`` is a ``busybox`` base with the -compiled binary of ``manager.go`` as the :ref:`Entrypoint -`. It is meant to be light and fast to download. - -If you would like to change or add things, you can download the full -``creack/manager`` repository that contains ``creack/manager:min`` and -``creack/manager:dev``. - -The Dockerfiles and the sources are available in -`/contrib/host_integration -`_. - - -Upstart -------- - -Upstart is the default process manager. The generated script will -start the container after the ``docker`` daemon. If the container -dies, it will respawn. Start/Restart/Stop/Reload are -supported. Reload will send a SIGHUP to the container. - -Example (``upstart`` on Debian) -............................... - -.. code-block:: bash - - CID=$(docker run -d creack/firefo-vnc) - docker run creack/manager:min -a 'Guillaume J. Charmes ' -d 'Awesome Firefox in VLC' $CID > /etc/init/firefoxvnc.conf - -You can now ``start firefoxvnc`` or ``stop firefoxvnc`` and if the container -dies for some reason, upstart will restart it. - -Systemd -------- - -In order to generate a systemd script, we need to use the ``-t`` -option. The generated script will start the container after docker -daemon. If the container dies, it will respawn. -``Start/Restart/Reload/Stop`` are supported. - -Example (``systemd`` on Fedora) -............................... - -.. code-block:: bash - - CID=$(docker run -d creack/firefo-vnc) - docker run creack/manager:min -t systemd -a 'Guillaume J. Charmes ' -d 'Awesome Firefox in VLC' $CID > /usr/lib/systemd/system/firefoxvnc.service - -You can now run ``systemctl start firefoxvnc`` or ``systemctl stop -firefoxvnc`` and if the container dies for some reason, ``systemd`` -will restart it. From ec488fa1231a9a5240dc0cd38c99ca3241fcaf7c Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Wed, 30 Oct 2013 14:36:38 -0700 Subject: [PATCH 09/10] fix warning in build --- runtime.go | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/runtime.go b/runtime.go index d9f5b41590..1eaa11c184 100644 --- a/runtime.go +++ b/runtime.go @@ -317,20 +317,29 @@ func (runtime *Runtime) Create(config *Config, name string) (*Container, []strin return nil, nil, err } + checkDeprecatedExpose := func(config *Config) bool { + if config != nil { + if config.PortSpecs != nil { + for _, p := range config.PortSpecs { + if strings.Contains(p, ":") { + return true + } + } + } + } + return false + } + + warnings := []string{} + if checkDeprecatedExpose(img.Config) || checkDeprecatedExpose(config) { + warnings = append(warnings, "The mapping to public ports on your host has been deprecated. Use -p to publish the ports.") + } + if img.Config != nil { if err := MergeConfig(config, img.Config); err != nil { return nil, nil, err } } - warnings := []string{} - if config.PortSpecs != nil { - for _, p := range config.PortSpecs { - if strings.Contains(p, ":") { - warnings = append(warnings, "The mapping to public ports on your host has been deprecated. Use -p to publish the ports.") - break - } - } - } if len(config.Entrypoint) != 0 && config.Cmd == nil { config.Cmd = []string{} From 3ff845904daabc47ed8f40b2edf3711b364ef206 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Wed, 30 Oct 2013 14:39:26 -0700 Subject: [PATCH 10/10] set containers comm to true by default --- docker/docker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/docker.go b/docker/docker.go index 362e899ba1..d1c59894d6 100644 --- a/docker/docker.go +++ b/docker/docker.go @@ -41,7 +41,7 @@ func main() { flag.Var(&flHosts, "H", "tcp://host:port to bind/connect to or unix://path/to/socket to use") flEnableIptables := flag.Bool("iptables", true, "Disable iptables within docker") flDefaultIp := flag.String("ip", "0.0.0.0", "Default ip address to use when binding a containers ports") - flInterContainerComm := flag.Bool("enable-container-comm", false, "Enable inter-container communication") + flInterContainerComm := flag.Bool("icc", true, "Enable inter-container communication") flag.Parse()