garethr / garethr-docker

Puppet module for managing docker
Apache License 2.0
397 stars 532 forks source link

Docker 17.06 cannot get #735

Open rohitbordia opened 6 years ago

rohitbordia commented 6 years ago

How, do we get docker 17.06 , when tagging with version "latest" it gets

Client: Version: 17.05.0-ce API version: 1.29 Go version: go1.7.5 Git commit: 89658be Built: Thu May 4 22:06:25 2017 OS/Arch: linux/amd64

Server: Version: 17.05.0-ce API version: 1.29 (minimum version 1.12) Go version: go1.7.5 Git commit: 89658be Built: Thu May 4 22:06:25 2017 OS/Arch: linux/amd64 Experimental: false

Justin-DynamicD commented 6 years ago

You need to update your repo. The defautl repo in this module is out of date.

So for example, in ubuntu my hiera.yaml contains:

docker_package_name: 'docker-ce' docker_package_source_location: 'https://download.docker.com/linux/centos/docker-ce.repo'

rohitbordia commented 6 years ago

If, I'm using the rpm package for the latest it does not work.

package_name => 'docker-engine', package_source => ' https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-17.06.1.ce-1.el7.centos.x86_64.rpm '

so should I use :

class { 'docker' : manage_package => true, use_upstream_package_source => false, docker_package_name: 'docker-ce' docker_package_source_location: 'https://download.docker.com/ linux/centos/docker-ce.repo' }

On Thu, Nov 2, 2017 at 12:13 PM, Justin King notifications@github.com wrote:

You need to update your repo. The defautl repo in this module is out of date.

So for example, in ubuntu my hiera.yaml contains:

docker_package_name: 'docker-ce' docker_package_source_location: 'https://download.docker.com/ linux/centos/docker-ce.repo'

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/garethr/garethr-docker/issues/735#issuecomment-341528760, or mute the thread https://github.com/notifications/unsubscribe-auth/AQyW_WJnkudGFLtewwsifmS0MuNrB4tWks5syhRqgaJpZM4QQMzu .

-- Thanks & Warm Regards Rohit

Justin-DynamicD commented 6 years ago

as an fyi, this seems to have been forked by the puppet team, This module may be on it's way to pasture:

https://forge.puppet.com/puppetlabs/docker

Justin-DynamicD commented 6 years ago

I'm sorry, I forgot my hiera doesn't translate properly ... let me do this again in puppet DSL:

package_name => $docker_package_name, package_source_location => $docker_package_source_location,

Hope that's a bit more clear.

rohitbordia commented 6 years ago

Thanks Justin, This is how I did :

class { 'docker' : manage_package => true, use_upstream_package_source => false, package_name => 'docker-ce', package_source_location => ' https://download.docker.com/linux/centos/docker-ce.repo' }

Below is the error

Execution of '/bin/yum -d 0 -e 0 -y --enablerepo=extras list docker-ce' returned 1: Error: No matching Packages to list [0m [1;31mError: /Stage[main]/Docker::Install/Package[docker]/ensure: change from absent to present failed: Execution of '/bin/yum -d 0 -e 0 -y --enablerepo=extras list docker-ce' returned 1: Error: No matching Packages to list [0m

On Thu, Nov 2, 2017 at 12:18 PM, Justin King notifications@github.com wrote:

I'm sorry, I forgot my hiera doesn't translate properly ... let me do this again in puppet DSL:

package_name => $docker_package_name, package_source_location => $docker_package_source_location,

Hope that's a bit more clear.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/garethr/garethr-docker/issues/735#issuecomment-341530085, or mute the thread https://github.com/notifications/unsubscribe-auth/AQyW_cwkVRzUO3Dwq0gsQo_eoZ_EPLHkks5syhWbgaJpZM4QQMzu .

-- Thanks & Warm Regards Rohit

rohitbordia commented 6 years ago

any idea why it cannot find docker-ce

davidius81 commented 6 years ago

Yup, because your specified the Repo file instead of the yum url,

The module has still useful features but it doesn't support the new packages, specially because the $docker_command variable now differ from daemon_command and the module is not support it at the moment. So I decided to install the package myself and use the feature I want after.

Here is what I have done:

I kept my example simple but I have also enabled the tls in my environment.

my hiera data looks like this.

docker:
   daemon:
    experimental: true
    insecure-registries:
    - myrepostiroy:5000
    hosts:
    - tcp://0.0.0.0:2376
    - unix:///var/run/docker.sock
    storage-driver: devicemapper
    storage-opts:
    - dm.directlvm_device=/dev/sdc
    - dm.thinp_percent=95
    - dm.thinp_metapercent=1
    - dm.thinp_autoextend_threshold=80
    - dm.thinp_autoextend_percent=20
    - dm.directlvm_device_force=false
    log-driver: "json-file"
    log-opts:
      max-size: "10m"
      max-file: "3"

In my profile I fetch the configuration as follow:

Hash $docker_daemon   = hiera('docker.daemon',undef),

 # Convert my puppet hash to json
  $docker_daemon_template = @(END)
  <%= require "json"; JSON.pretty_generate @docker_daemon%>
  END

  file { '/etc/docker/daemon.json':
    ensure => file,
    owner  => root,
    group  => root,
    mode   => '644',
    content =>  inline_template($docker_daemon_template),
    notify  => Exec['Reload Docker Configuration'],
  }

  yumrepo { 'docker-ce-stable':
    descr    => 'Docker CE Stable - $basearch',
    baseurl  => 'https://download.docker.com/linux/centos/7/$basearch/stable',
    gpgkey   => 'https://download.docker.com/linux/centos/gpg',
    gpgcheck => true,
  }

  package { "docker-ce": 
    ensure => "installed",
    require => Yumrepo['docker-ce-stable'],
    }  

  service { "docker":
    ensure     => running,
    enable     => true,
    hasrestart => true,
    hasstatus  => true,
    require    => [
                    Package['docker-ce'],
                    File['/etc/docker/daemon.json'],
                  ],
  }

exec { 'Reload Docker Configuration':
    command => "/bin/systemctl reload docker",
    refreshonly => true,
  }

I hope this will help others!

Have fun:)