You are not logged in.

#1 2014-11-27 13:29:00

Paul15071992
Member
From: Vienna
Registered: 2014-08-30
Posts: 31

docker configuration [SOLVED]

Hello,

I'm trying to configure a docker, but I don't really know how to do it. First I read the documentation from the wiki, but it wasn't enough. I did the same configuration on Ubuntu, but there, the docker config file is different.

I want to configure the docker like this (Ubuntu configuration):

DOCKER_OPTS="--bip=172.17.42.1/16 --dns=172.17.42.1 -H tcp://192.168.1.1:4243 -H unix:///var/run/docker.sock"

Could somebody give me a hint?

Thank you!

Last edited by Paul15071992 (2014-12-10 10:31:46)

Offline

#2 2014-11-27 16:29:59

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: docker configuration [SOLVED]

You need to setup a systemd override file with the correct options. I'm on mobile right so I can't easily give an example... Hopefully that sends you in the right direction for now.

Scott

Edit (at my computer now):

Create file /etc/systemd/system/docker.d/my_config.conf

[Service]
ExecStart=
ExecStart=/usr/bin/docker --bip=172.17.42.1/16 --dns=172.17.42.1 -H tcp://192.168.1.1:4243 -H unix:///var/run/docker.sock

From 'man systemd.unit':

Along with a unit file foo.service, a directory foo.service.d/ may exist. All
files with the suffix ".conf" from this directory will be parsed after the file
itself is parsed. This is useful to alter or add configuration settings to a
unit, without having to modify their unit files. Make sure that the file that
is included has the appropriate section headers before any directive. Note that
for instanced units this logic will first look for the instance ".d/"
subdirectory and read its ".conf" files, followed by the template ".d/"
subdirectory and reads its ".conf" files.

You have to put the blank ExecStart= line in to ensure that directive gets overridden.

Last edited by firecat53 (2014-11-27 18:31:28)

Offline

#3 2014-11-28 09:43:59

Paul15071992
Member
From: Vienna
Registered: 2014-08-30
Posts: 31

Re: docker configuration [SOLVED]

I did that and then restarted the docker, but after the restart, when using the command

systemctl status docker

I get the a failure

docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled)
   Active: failed (Result: exit-code) since Fri 2014-11-28 10:37:18 CET; 1min 24s ago
     Docs: http://docs.docker.com
  Process: 1813 ExecStart=/usr/bin/docker --bip=172.17.42.1/16 --dns=172.17.42.1 -H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock (code=exited, status=1/FAILURE)
 Main PID: 1813 (code=exited, status=1/FAILURE)

Offline

#4 2014-11-28 16:03:50

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: docker configuration [SOLVED]

Two things:

1. Provide the relevant journactl output for docker.service
2. Try starting docker from the command line directly with those options to make sure you got the options right

Scott

Offline

#5 2014-12-01 08:21:40

Paul15071992
Member
From: Vienna
Registered: 2014-08-30
Posts: 31

Re: docker configuration [SOLVED]

journalctl output:

-- Logs begin at Thu 2014-08-07 19:22:23 CEST, end at Mon 2014-12-01 09:15:44 CET. --
Dec 01 09:15:15 paulArchie docker[347]: 2014/12/01 09:15:15 Received signal 'terminated', starting shutdown of docker...
Dec 01 09:15:15 paulArchie docker[3009]: 2014/12/01 09:15:15 docker daemon: 1.3.2 39fa2fa; execdriver: native; graphdriver:
Dec 01 09:15:15 paulArchie docker[3009]: [63c05fd9] +job serveapi(tcp://127.0.0.1:4243, fd://)
Dec 01 09:15:15 paulArchie docker[3009]: [info] Listening for HTTP on tcp (127.0.0.1:4243)
Dec 01 09:15:15 paulArchie docker[3009]: [info] Listening for HTTP on fd ()
Dec 01 09:15:15 paulArchie docker[3009]: [63c05fd9] +job init_networkdriver()
Dec 01 09:15:15 paulArchie docker[3009]: [63c05fd9] -job init_networkdriver() = OK (0)
Dec 01 09:15:15 paulArchie docker[3009]: 2014/12/01 09:15:15 WARNING: Your kernel does not support cgroup swap limit.
Dec 01 09:15:15 paulArchie docker[3009]: [info] Loading containers:
Dec 01 09:15:15 paulArchie docker[3009]: .....................................................................[info] : done.
Dec 01 09:15:15 paulArchie docker[3009]: [63c05fd9] +job acceptconnections()
Dec 01 09:15:15 paulArchie docker[3009]: [63c05fd9] -job acceptconnections() = OK (0)
Dec 01 09:15:24 paulArchie docker[3009]: 2014/12/01 09:15:24 Received signal 'terminated', starting shutdown of docker...
Dec 01 09:15:25 paulArchie docker[3058]: 2014/12/01 09:15:25 docker daemon: 1.3.2 39fa2fa; execdriver: native; graphdriver:
Dec 01 09:15:25 paulArchie docker[3058]: [307a8255] +job serveapi(tcp://127.0.0.1:4243, fd://)
Dec 01 09:15:25 paulArchie docker[3058]: [info] Listening for HTTP on tcp (127.0.0.1:4243)
Dec 01 09:15:25 paulArchie docker[3058]: [info] Listening for HTTP on fd ()
Dec 01 09:15:25 paulArchie docker[3058]: [307a8255] +job init_networkdriver()
Dec 01 09:15:25 paulArchie docker[3058]: [307a8255] -job init_networkdriver() = OK (0)
Dec 01 09:15:25 paulArchie docker[3058]: 2014/12/01 09:15:25 WARNING: Your kernel does not support cgroup swap limit.
Dec 01 09:15:25 paulArchie docker[3058]: [info] Loading containers:
Dec 01 09:15:25 paulArchie docker[3058]: .....................................................................[info] : done.
Dec 01 09:15:25 paulArchie docker[3058]: [307a8255] +job acceptconnections()
Dec 01 09:15:25 paulArchie docker[3058]: [307a8255] -job acceptconnections() = OK (0)
Dec 01 09:15:44 paulArchie docker[3058]: 2014/12/01 09:15:44 Received signal 'terminated', starting shutdown of docker...
Dec 01 09:15:44 paulArchie docker[3120]: 2014/12/01 09:15:44 Please specify only one -H
Dec 01 09:15:44 paulArchie systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Dec 01 09:15:44 paulArchie systemd[1]: Unit docker.service entered failed state.
Dec 01 09:15:44 paulArchie systemd[1]: docker.service failed.

Offline

#6 2014-12-01 09:03:17

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: docker configuration [SOLVED]

The drop-in configuration dir should be "docker.service.d". When systemd sees it, any *.conf files should also show up in systemctl status output.

Offline

#7 2014-12-01 09:07:37

Paul15071992
Member
From: Vienna
Registered: 2014-08-30
Posts: 31

Re: docker configuration [SOLVED]

there is no file

docker.service.d

all I have are

/usr/lib/systemd/system/docker.service
/usr/lib/systemd/system/docker.socket

Offline

#8 2014-12-01 10:00:46

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: docker configuration [SOLVED]

firecat53 wrote:

[..]

Create file /etc/systemd/system/docker.d/my_config.conf

[..]

Paul15071992 wrote:

I did that [..]

Offline

#9 2014-12-03 13:24:59

Paul15071992
Member
From: Vienna
Registered: 2014-08-30
Posts: 31

Re: docker configuration [SOLVED]

I get the same error with the

/etc/systemd/system/docker.service.d/my_config.conf

Error:

docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled)
  Drop-In: /etc/systemd/system/docker.service.d
           └─my_config.conf
   Active: failed (Result: exit-code) since Wed 2014-12-03 14:22:48 CET; 9s ago
     Docs: http://docs.docker.com
           http://docs.docker.com
  Process: 6121 ExecStart=/usr/bin/docker --bip=172.17.42.1/16 --dns=172.17.42.1 -H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock (code=exited, status=1/FAILURE)
 Main PID: 6121 (code=exited, status=1/FAILURE)

Dec 03 14:22:48 irianArchie docker[6121]: 2014/12/03 14:22:48 Please specify only one -H
Dec 03 14:22:48 irianArchie systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Dec 03 14:22:48 irianArchie systemd[1]: Unit docker.service entered failed state.
Dec 03 14:22:48 irianArchie systemd[1]: docker.service failed

Offline

#10 2014-12-03 14:42:35

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: docker configuration [SOLVED]

Well, it says you've got -H listed twice. It looks like you do...did you try taking out one of the -H parameters?

Scott

Offline

#11 2014-12-03 14:54:11

Paul15071992
Member
From: Vienna
Registered: 2014-08-30
Posts: 31

Re: docker configuration [SOLVED]

I've changed it and now I get this

systemctl restart docker:

docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled)
  Drop-In: /etc/systemd/system/docker.service.d
           └─my_config.conf
   Active: failed (Result: start-limit) since Wed 2014-12-03 15:44:24 CET; 38s ago
     Docs: http://docs.docker.com
           http://docs.docker.com
  Process: 9727 ExecStart=/usr/bin/docker --bip=172.17.42.1/16 --dns=172.17.42.1 -H tcp://127.0.0.1:4243 unix:///var/run/docker.sock (code=exited, status=0/SUCCESS)
 Main PID: 9727 (code=exited, status=0/SUCCESS)

Dec 03 15:44:24 irianArchie docker[9727]: save      Save an image to a tar archive
Dec 03 15:44:24 irianArchie docker[9727]: search    Search for an image on the Docker Hub
Dec 03 15:44:24 irianArchie docker[9727]: start     Start a stopped container
Dec 03 15:44:24 irianArchie docker[9727]: stop      Stop a running container
Dec 03 15:44:24 irianArchie docker[9727]: tag       Tag an image into a repository
Dec 03 15:44:24 irianArchie docker[9727]: top       Lookup the running processes of a container
Dec 03 15:44:24 irianArchie docker[9727]: unpause   Unpause a paused container
Dec 03 15:44:24 irianArchie docker[9727]: version   Show the Docker version information
Dec 03 15:44:24 irianArchie docker[9727]: wait      Block until a container stops, then print its exit code
Dec 03 15:44:24 irianArchie docker[9727]: Run 'docker COMMAND --help' for more information on a command.

docker info:

Cannot connect to the Docker daemon. Is 'docker -d' running on this host?

docker -d:

2014/12/03 15:50:38 docker daemon: 1.3.2 39fa2fa; execdriver: native; graphdriver: 
[8293e608] +job serveapi(unix:///var/run/docker.sock)
2014/12/03 15:50:38 open /var/run/docker.pid: permission denied

Offline

#12 2014-12-03 16:06:01

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: docker configuration [SOLVED]

Oops, sorry didn't notice before... you're missing the -d flag (run as daemon) from the docker command line.

Scott

Offline

#13 2014-12-04 08:00:58

Paul15071992
Member
From: Vienna
Registered: 2014-08-30
Posts: 31

Re: docker configuration [SOLVED]

if I run sudo docker -d, I get

2014/12/04 08:58:56 docker daemon: 1.3.2 39fa2fa; execdriver: native; graphdriver: 
[0179cb16] +job serveapi(unix:///var/run/docker.sock)
[info] Listening for HTTP on unix (/var/run/docker.sock)
[0179cb16] +job init_networkdriver()
[0179cb16] -job init_networkdriver() = OK (0)
2014/12/04 08:58:56 WARNING: Your kernel does not support cgroup swap limit.
[info] Loading containers: 
.....................................................................[info] : done.
[0179cb16] +job acceptconnections()
[0179cb16] -job acceptconnections() = OK (0)

so I think that it works now.

thank you!
~Paul~

Offline

#14 2014-12-04 13:51:07

Paul15071992
Member
From: Vienna
Registered: 2014-08-30
Posts: 31

Re: docker configuration [SOLVED]

i managed to solve the problem, by exporting my options in DOCKER_HOST and DOCKE_OPTS

Last edited by Paul15071992 (2014-12-04 14:25:24)

Offline

#15 2014-12-04 15:28:45

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: docker configuration [SOLVED]

When you get it working right, make to post your final solution for posterity and mark your thread as [SOLVED]

Scott

Offline

#16 2014-12-10 10:40:11

Paul15071992
Member
From: Vienna
Registered: 2014-08-30
Posts: 31

Re: docker configuration [SOLVED]

My solution:

/etc/systemd/system/docker.service.d/my_config.conf

[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=network.target docker.socket
Requires=docker.socket

[Service]
ExecStart=
ExecStart=/usr/bin/docker -d --bip=172.17.42.1/16 --dns=172.17.42.1 -H tcp://127.0.0.1:4243 
LimitNOFILE=1048576
LimitNPROC=1048576

[Install]
WantedBy=multi-user.target
Also=docker.socket

.bashrc

export DOCKER_HOST="tcp://127.0.0.1:4243"

because the docker is listening to the address "127.0.0.1:4243"

Offline

Board footer

Powered by FluxBB