Skip to content

Error running in Centos 7 and Debian 8 #259

@dploeger

Description

@dploeger

What you expected to happen?

Containers start well on Centos 7 and Debian 8 just like they do on Debian 9, Ubuntu 16.04 and 18.04.

What happened?

The container isn't started by systemd. This error message pops up in journal:

Jul 05 07:25:54 default-centos-7.vagrantup.com systemd[1]: Started Daemon for hana-testhana1.
Jul 05 07:25:55 default-centos-7.vagrantup.com docker-hana-testhana1[8468]: /usr/bin/docker: invalid reference format.
Jul 05 07:25:55 default-centos-7.vagrantup.com docker-hana-testhana1[8468]: See '/usr/bin/docker run --help'.

Copying and pasting the ExecStart command directly to the terminal works. So I believe, this is some weird escaping issue with systemd on Centos 7 and Debian 8. I propose writing a startup script and not simply pasting the docker run command into ExecStart.

How to reproduce it?

Configure the module like this:

  class {
  'hanaexpress':
    store_username => 'some-docker-store-user',
    store_password => 'its-password'
}
  docker::run {
    "hana-testhana1":
      hostname => "hana-testhana1",
      image => "store/saplabs/hanaexpress:2.00.030.00.20180403.2",
      ports => [
        "39017:39017",
        "39041:39041"
      ],
      volumes => [
        "/data/testhana1:/hana/mounts"
      ],
      extra_parameters => [
        "--ulimit nofile=1048576:1048576",
        "--sysctl kernel.shmmax=1073741824",
        "--sysctl net.ipv4.ip_local_port_range=\"40000 60999\"",
        "--sysctl kernel.shmmni=524288",
        "--sysctl kernel.shmall=8388608",
      ],
      command => "--passwords-url file:///hana/mounts/password.json --agree-to-sap-license"
  }

This is based on our SAP HANA Express puppet module. (We're using the SAP HANA Express docker image here)

Anything else we need to know?

This is the systemd service unit generated by the module:

# This file is managed by Puppet and local changes
# may be overwritten

[Unit]
Description=Daemon for hana-testhana1
After=docker.service
Wants=
Requires=docker.service

[Service]
Restart=on-failure
StartLimitInterval=20
StartLimitBurst=5
TimeoutStartSec=0
RestartSec=5
Environment="HOME=/root"
SyslogIdentifier=docker-hana-testhana1
ExecStartPre=-/usr/bin/docker kill hana-testhana1
ExecStartPre=-/usr/bin/docker rm  hana-testhana1

ExecStart=/usr/bin/docker run \
        -h 'hana-testhana1' --net bridge -m 0b -p 39017:39017 \
 -p 39041:39041 \
 -v /data/testhana1:/hana/mounts \
 --ulimit nofile=1048576:1048576 --sysctl kernel.shmmax=1073741824 --sysctl net.ipv4.ip_local_port_range="40000 60999" --sysctl kernel.shmmni=524288 --sysctl kernel.shmall=8388608 \
        --name hana-testhana1 \
        store/saplabs/hanaexpress:2.00.030.00.20180403.2 \
         --passwords-url file:///hana/mounts/password.json --agree-to-sap-license
ExecStop=-/usr/bin/docker stop --time=0 hana-testhana1
ExecStop=-/usr/bin/docker rm  hana-testhana1

[Install]
WantedBy=multi-user.target

Versions:

[root@default-centos-7 ~]# puppet --version
docker ve5.5.2
[root@default-centos-7 ~]# docker version
Client:
 Version:      18.03.1-ce
 API version:  1.37
 Go version:   go1.9.5
 Git commit:   9ee9f40
 Built:        Thu Apr 26 07:20:16 2018
 OS/Arch:      linux/amd64
 Experimental: false
 Orchestrator: swarm

Server:
 Engine:
  Version:      18.03.1-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.9.5
  Git commit:   9ee9f40
  Built:        Thu Apr 26 07:23:58 2018
  OS/Arch:      linux/amd64
  Experimental: false
[root@default-centos-7 ~]# facter os
{
  architecture => "x86_64",
  family => "RedHat",
  hardware => "x86_64",
  name => "CentOS",
  release => {
    full => "7.4.1708",
    major => "7",
    minor => "4"
  },
  selinux => {
    config_mode => "permissive",
    config_policy => "targeted",
    current_mode => "permissive",
    enabled => true,
    enforced => false,
    policy_version => "28"
  }
}
[root@default-centos-7 ~]# puppet module list
/etc/puppetlabs/code/environments/production/modules (no modules installed)
/etc/puppetlabs/code/modules (no modules installed)
/opt/puppetlabs/puppet/modules (no modules installed)
[root@default-centos-7 ~]# puppet module list --modulepath=/tmp/kitchen/modules
/tmp/kitchen/modules
├── dodevops-hanaexpress (v0.1.0)
├── herculesteam-augeasproviders_core (v2.1.4)
├── herculesteam-augeasproviders_sysctl (v2.2.0)
├── puppetlabs-apt (v4.5.1)
├── puppetlabs-docker (v1.1.0)
├── puppetlabs-stdlib (v4.25.1)
└── puppetlabs-translate (v1.0.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions