Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

starting container with HostConfig was deprecated since v1.10 and removed in v1.12 #6

Closed
surajssd opened this issue Aug 19, 2016 · 10 comments

Comments

@surajssd
Copy link

On a machine with docker v1.12 it throws above error error, but works fine on docker v1.10.3

running:

$ imagebuilder . surajkanginx
--> Image fedora was not found, pulling ...
--> Pulled 0/1 layers, 7% complete
--> Pulled 1/1 layers, 100% complete
--> Extracting
--> FROM fedora
unable to start build container: API error (400): {"message":"starting container with HostConfig was deprecated since v1.10 and removed in v1.12"}

dockerfile:

 $ cat Dockerfile 
FROM fedora
MAINTAINER http://fedoraproject.org/wiki/Cloud

RUN dnf -y update && dnf clean all
RUN dnf -y install nginx && dnf clean all
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN echo "nginx on Fedora" > /usr/share/nginx/html/index.html

EXPOSE 80

CMD [ "/usr/sbin/nginx" ]

docker version

$ docker version
Client:
 Version:      1.12.0
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   8eab29e
 Built:        
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.0
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   8eab29e
 Built:        
 OS/Arch:      linux/amd64
@smarterclayton
Copy link
Contributor

Where does hostconfig go in 1.12?

@jawnsy
Copy link

jawnsy commented Sep 1, 2016

@smarterclayton from talking to @runcom, I think the problem is that HostConfig is part of image creation but not running, or something like that. I can reproduce the problem with imagebuilder on rawhide, so will see if I can fix it.

@runcom
Copy link
Member

runcom commented Sep 1, 2016

@smarterclayton @jawnsy the HostConfig must be set at container create (docker create) as opposed to set it at container start (docker start). This has been a deprecated feature introduced in docker 1.12.x. Let me know if you need any other help on this.

@jawnsy
Copy link

jawnsy commented Sep 1, 2016

Just adding context... From the release notes: POST /containers/(id or name)/start no longer accepts a HostConfig.

@smarterclayton
Copy link
Contributor

As discussed on IRC with @jawnsy and @mrunalp we can do the following:

  1. Create a new container that has the "fat" volume mounted that we docker cp into.
  2. Delete the container
  3. Bind mount from the volume into our new container for each individual bind.

We can probably reuse the same image that we'll be launching since it's guaranteed to be local and we won't be starting the container, just copying into it.

@smarterclayton
Copy link
Contributor

Added a PR, please try it out and see if it works for you (can't get docker-latest running currently because of an older system)

@jawnsy
Copy link

jawnsy commented Oct 18, 2016

@smarterclayton Thanks for fixing this!

docker engine information

$ sudo dnf list --installed docker
docker.x86_64                                                           2:1.12.1-13.git9a3752d.fc25

$ docker version
Client:
 Version:         1.12.1
 API version:     1.24
 Package version: docker-1.12.1-13.git9a3752d.fc25.x86_64
 Go version:      go1.7.1
 Git commit:      9a3752d/1.12.1
 Built:           
 OS/Arch:         linux/amd64

Server:
 Version:         1.12.1
 API version:     1.24
 Package version: docker-1.12.1-13.git9a3752d.fc25.x86_64
 Go version:      go1.7.1
 Git commit:      9a3752d/1.12.1
 Built:           
 OS/Arch:         linux/amd64

$ docker info
Containers: 3
 Running: 1
 Paused: 0
 Stopped: 2
Images: 75
Server Version: 1.12.1
Storage Driver: overlay
 Backing Filesystem: xfs
Logging Driver: journald
Cgroup Driver: systemd
Plugins:
 Volume: local
 Network: host overlay bridge null
Swarm: inactive
Runtimes: runc oci
Default Runtime: oci
Security Options: seccomp
Kernel Version: 4.8.1-1.fc25.x86_64
Operating System: Fedora 25 (Twenty Five)
OSType: linux
Architecture: x86_64
Number of Docker Hooks: 2
CPUs: 2
Total Memory: 1.797 GiB
Name: limelight
ID: 34RW:RSXM:DEXS:EIS6:SV2U:7TDS:A2XY:RYBY:Q3UN:Z4CA:R6CR:IACW
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Insecure Registries:
 127.0.0.0/8
Registries: docker.io (secure)

Built the imagebuilder using:

$ git remote add smarterclayton https://github.com/smarterclayton/imagebuilder
$ git checkout smarterclayton/mount_secret
$ export GOPATH=~/projects/imagebuilder
$ go install -v github.com/openshift/imagebuilder/cmd/imagebuilder

Manually built the origin/openvswitch image:

$ imagebuilder ~/projects/origin/images/openvswitch openvswitch
<build output>
--> Committing changes to openvswitch ...
--> Done

Using the embedded imagebuilder (which doesn't include this change), reproducing the problem:

$ ~/projects/origin/_output/local/bin/linux/amd64/oc ex dockerbuild ~/projects/origin/images/openvswitch openvswitch
--> FROM openshift/origin-base
error: unable to start build container: API error (400): {"message":"starting container with HostConfig was deprecated since v1.10 and removed in v1.12"}

So this change appears to have fixed it 😄 👍 🎉

@jawnsy
Copy link

jawnsy commented Oct 18, 2016

Unfortunately, the conformance tests are failing with 1.12. This requires further investigation, though at least it seems like a step in the right direction.

$ go test -v github.com/openshift/imagebuilder/dockerclient/  -tags conformance
=== RUN   TestConformanceInternal
--- PASS: TestConformanceInternal (28.46s)
=== RUN   TestConformanceExternal
--- PASS: TestConformanceExternal (485.71s)
    conformance_test.go:299: WARNING: opt/app-root/src/.gem/ruby/gems/json-1.8.3/ext/json/ext/parser/Makefile differs only in size by -2 bytes, probably a timestamp value change
    conformance_test.go:299: WARNING: opt/app-root/src/.gem/ruby/extensions/x86_64-linux/json-1.8.3/gem_make.out differs only in size by -1 bytes, probably a timestamp value change
    conformance_test.go:299: WARNING: opt/app-root/src/.gem/ruby/gems/json-1.8.3/ext/json/ext/generator/Makefile differs only in size by -2 bytes, probably a timestamp value change
    conformance_test.go:299: WARNING: etc/ssl/private/ssl-cert-snakeoil.key differs only in size by 4 bytes, probably a timestamp value change
=== RUN   TestTransientMount
--- FAIL: TestTransientMount (1.25s)
    conformance_test.go:167: unable to build image: running '/bin/sh -c ls /mountdir/subdir' failed with exit code 1
=== RUN   TestCalcCopyInfo
--- PASS: TestCalcCopyInfo (0.00s)
FAIL
exit status 1
FAIL    github.com/openshift/imagebuilder/dockerclient  515.426s

@maxamillion
Copy link
Member

@smarterclayton ping

I'm still seeing this issue with oc cluster up with origin:v1.5.0 docker image.

$ oc cluster up
-- Checking OpenShift client ... OK
-- Checking Docker client ... OK
-- Checking Docker version ... OK
-- Checking for existing OpenShift container ... OK
-- Checking for openshift/origin:v1.5.0 image ... OK
-- Checking Docker daemon configuration ... OK
-- Checking for available ports ... OK
-- Checking type of volume mount ...
   Using nsenter mounter for OpenShift volumes
-- Creating host directories ... OK
-- Finding server IP ...
   Using 192.168.122.50 as the server IP
-- Starting OpenShift container ...
   Creating initial OpenShift configuration
   Starting OpenShift using container 'origin'
   Waiting for API server to start listening
   OpenShift server started
-- Adding default OAuthClient redirect URIs ... OK
-- Installing registry ... OK
-- Installing router ... OK
-- Importing image streams ... OK
-- Importing templates ... OK
-- Login to server ... OK
-- Creating initial project "myproject" ... OK
-- Removing temporary directory ... OK
-- Checking container networking ... OK
-- Server Information ...
   OpenShift server started.
   The server is accessible via web console at:
       https://192.168.122.50:8443

   You are logged in as:
       User:     developer
       Password: developer

   To login as administrator:
       oc login -u system:admin

$ oc login -u system:admin
Logged into "https://192.168.122.50:8443" as "system:admin" using existing credentials.

You have access to the following projects and can switch between them with 'oc project <projectname>':

    default
    kube-system
  * myproject
    openshift
    openshift-infra

Using project "myproject".

$ oc ex dockerbuild buildroot/ buildroot:latest
--> FROM centos:7
error: unable to start build container: API error (400): {"message":"starting container with HostConfig was deprecated since v1.10 and removed in v1.12"}

@smarterclayton
Copy link
Contributor

smarterclayton commented Jun 8, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants