Salt: 'dockerng' __virtual__ returned False - docker

I have Debian Jessie and I'm trying to manage Docker containers with Salt dockerng. But when I try for example this state:
# file: docker_demo.sls
hello-world:
dockerng.image_present
Then sudo salt '*' state.highstate fails:
----------
ID: hello-world
Function: dockerng.image_present
Result: False
Comment: State 'dockerng.image_present' was not found in SLS 'docker_demo'
Reason: 'dockerng' __virtual__ returned False
Started:
Duration:
Changes:
How can I fix this so dockerng.image_present can pull the image, dockerng.running can run Docker containers etc.?

The dockerng module executed by Salt minion communicates with Docker daemon over REST API using docker-py (not the CLI command docker).
The error message 'dockerng' __virtual__ returned False is a little bit misleading, but if you see the source code, it returns False because it cannot import Pyhon module docker. So this Python package must be installed.
There are packages in Debian repository: python-docker and python3-docker. But both are incompatible with the recent docker-engine (installed from APT repository deb https://apt.dockerproject.org/repo debian-jessie).
So the solution is to uninstall python-docker package if installed and to install the latest docker-py using pip:
sudo apt-get install python-pip
sudo pip install docker-py
Or use this Salt state:
python-pip:
pkg.installed
docker-py:
pip.installed:
- require:
- pkg: python-pip
Or just run
salt myminion pip.install docker-py
The python-docker package from Debian Stretch (now testing, should become Debian stable in 2017) seems to be working OK.

Related

unable to verify that docker engine is installed by reaching pull rate limit

I wanted to install docker on my laptop to test and run my web applications on it's containers instead of virtual environment (I am running ubuntu desktop version 20.04 LTS and using pipenv for virtual environment). After signing up at hub.docker I went to https://docs.docker.com/engine/install/ubuntu/(hub.docker manual to install docker on ubuntu), I decided to install using the repository and typed following commands in terminal
1.sudo apt-get update
2.sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
3.curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
4.apt-key fingerprint 0EBFCD88
after running last command I got desired result which was
" pub rsa4096 2017-02-22 [SCEA]
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [ unknown] Docker Release (CE deb) docker#docker.com
sub rsa4096 2017-02-22 [S]"
As my system is amd64 I continued by
5.sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
6.sudo apt-get update
7.sudo apt-get install docker-ce docker-ce-cli containerd.io
8.sudo docker run hello-world
then at this point I got
"Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit.
See 'docker run --help'."
Questions
Did I do anything wrong in installation process?
How can I run to pull rate limit when I have just installed it?
Have docker correctly installed on my laptop? (when I type docker --version in terminal I get "Docker version 20.10.2, build 2291f61"
What should I do now?
I just installed docker myself and encountered the same error.
I don't think you have installed it wrong (since I'm a newbie myself I cannot confirm it 100%), but I solved this error by creating an account in docker website and then logged-in from CLI.
to create an account go to: https://www.docker.com/pricing
and then use signup for free.
To login through CLI type:
docker login -u your-username
and then it asks for your password, and then you are good to go!

Error while running (docker_image) module ansible Playbook

I have my docker images in nexus. When i am trying to run that playbook i am getting error
Playbook Code
---
- hosts: localhost
become: True
tasks:
- name: pull an image
docker_image:
name: 10.220.110.10:8083/halosys:f5a950f
source: pull
...
ERROR while running my playbook
TASK [pull an image] **************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (docker_image) module: source Supported parameters include: api_version, archive_path, buildargs, cacert_path, cert_path, container_limits, debug, docker_host, dockerfile, force, http_timeout, key_path, load_path, name, nocache, path, pull, push, repository, rm, ssl_version, state, tag, timeout, tls, tls_hostname, tls_verify, use_tls"}
Please help to fix this error
Option source was added in Ansible 2.8 - see documentation. The error message states it is missing, so you're using older version. To fix this you need to either update your Ansible installation to at least version 2.8 or check the documentation for your version.
For example, Ansible 2.7 documentation states that to pull an image you need to do:
- name: pull an image
docker_image:
name: 10.220.110.10:8083/halosys:f5a950f
To check what version of Ansible you're running use command
ansible --version
EDIT:
I can’t guarantee it’ll work, but I would try removing Ansible installed from system packages:
sudo yum remove ansible
followed by installing Python 3:
sudo yum install python36 python36-virtualenv python36-pip
then installing docker-py using pip:
python3 -m pip install docker-py
And finally installing Ansible with Python3 support:
python3 -m pip install ansible
Here’s Ansible documentation about Python3 support.
Also if package python36 is not available you can run
sudo yum list | grep python3
to find what version is available. As per documentation mentioned above you need at least python35 to make Ansible work.

Problem installing Docker Ubuntu, step related to command "pub" (Ubuntu 18.04)

My ubuntu version:
No LSB modules are available./
Distributor ID: Ubuntu /
Description: Ubuntu 18.04.3 LTS /
Release: 18.04 /
Codename: bionic
To install Docker Engine - Community, you need the 64-bit version of one of these Ubuntu versions:
Disco 19.04
Cosmic 18.10
Bionic 18.04 (LTS) (Mine)
Xenial 16.04 (LTS)
Steps I followed:
Uninstall old versions
$ sudo apt-get remove docker docker-engine docker.io containerd runc
Update the apt package index:
$ sudo apt-get update #HasErrors (2)
(1) Err:14 https://dl.bintray.com/rabbitmq/debian $distribution Release
404 Not Found [IP: 3.124. ..........]
------------------------------------------------
(2) E: The repository 'https://dl.bintray.com/rabbitmq/debian $distribution Release' does not have a Release file.
In consequence: When I get to step 3 in the webpage: https://docs.docker.com/install/linux/docker-ce/ubuntu/
$ sudo apt-key fingerprint 0EBFCD88
pub rsa4096 2017-02-22 [SCEA]
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [ unknown] Docker Release (CE deb) <docker#docker.com>
sub rsa4096 2017-02-22 [S]
I get this error:
Command 'pub' not found, did you mean:
command 'hub' from snap hub (v2.13.0)
command 'dub' from snap dub (1.15.0)
command 'pcb' from deb pcb-gtk
command 'pcb' from deb pcb-lesstif
command 'pua' from deb pglistener
command 'pudb' from deb python-pudb
command 'puf' from deb puf
command 'pdb' from deb python
command 'dub' from deb dub
command 'publ' from deb atfs
See 'snap info <snapname>' for additional versions.
I just want to install Docker for Ubuntu and i am a little stuck here
Instead of installing from the repository, why don't you try doing it directly.
sudo apt-get update
sudo apt-get remove docker docker-engine docker.io
sudo apt install docker.io
sudo systemctl start docker
sudo systemctl enable docker
If this works, you will notice it only works with sudo the workaround for this issue is mentioned here
Let me know if this doesn't work! I'm also quite confused as to why your errors include RabbitMQ when you are trying to install docker on ubuntu?

install a specific version of kubernetes on centos

I installed kubernetes using these commands on centos7
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
setenforce 0
yum install -y kubelet kubeadm kubectl
This will install the latest version, so i'm looking for a method to install a specific version. for example 1.8.1
Thank you
To install a specific version of the package it is enough to define it during the yum install command:
yum install -y kubelet-<version> kubectl-<version> kubeadm-<version>
But for your particular case, when you want to install kubernetes version 1.8.1, kubernetes-cni package should be 0.5.1 version to satisfy dependency requirements:
--> Finished Dependency Resolution
Error: Package: kubelet-1.8.1-1.x86_64 (kubernetes)
Requires: kubernetes-cni = 0.5.1
Available: kubernetes-cni-0.3.0.1-0.07a8a2.x86_64 (kubernetes)
kubernetes-cni = 0.3.0.1-0.07a8a2
Available: kubernetes-cni-0.5.1-0.x86_64 (kubernetes)
kubernetes-cni = 0.5.1-0
Available: kubernetes-cni-0.5.1-1.x86_64 (kubernetes)
kubernetes-cni = 0.5.1-1
Installing: kubernetes-cni-0.6.0-0.x86_64 (kubernetes)
kubernetes-cni = 0.6.0-0
So, the final command is:
yum install -y kubelet-1.8.1 kubectl-1.8.1 kubeadm-1.8.1 kubernetes-cni-0.5.1
Kubernetes cluster can be ready to use in minutes, and it does not depend much on rpm/deb packages delivered by operating system vendors.
Packages are delivered for user's comfort and consistency of installation. Usually, it is possible to downgrade packages provided by CentOS without breaking dependencies, but you need to be careful.
Kubernetes includes the kubeadm tool, which can setup all dependencies and spin up cluster in version provided in the command line:
sudo kubeadm init --kubernetes-version=v1.9.2
The installation process of a specific version is described in
installation manual. I've also used scripts.
To avoid compatibility problem, please make sure your Kubernetes version is compatible with Docker containers engine version.

Yum install / update not working inside docker images but working otherwise from the centos machine

I am able to yum install, or yum update from the server, but when trying to do same (as specified in the Dockerfile) inside a docker container, it fails stating the following common error :
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=<repoid> ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable <repoid>
or
subscription-manager repos --disable=<repoid>
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64
my Docker file is a simple :
FROM centos:centos7
RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf
RUN echo "nameserver 8.8.4.4" >> /etc/resolv.conf
RUN yum -y update; yum clean all
RUN yum -y install epel-release; yum clean all
RUN yum -y install python-pip; yum clean all
I have tried various things like adding ip_resolve=4 in /etc/yum.conf, or addinf 8.8.8.8 and 4.4.4.4 to /etc/resolv.conf and other methods, in vain.
here's the docker info :
Containers: 28
Running: 0
Paused: 0
Stopped: 28
Images: 144
Server Version: 1.13.0
docker-compose version 1.10.1, build b252738
docker-py version: 2.0.2
CPython version: 2.7.5
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
Please help. I am only running things under a VPN, no proxy.
machine is an AMI : 3.10.0-514.el7.x86_64.
Need I add it's IP anywhere insde docker container? Please help.
TIA!

Resources