-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Unable to deploy container #230
Comments
Hi! And thanks for using the role :) As the Docker user, can you get the Python version and the output of What distribution are you running by the way? |
Operating System: Red Hat Enterprise Linux 8.8 (Ootpa) you command did not work for me so I had to run a variation, it does not seem to be working correctly, but do not see docker in the list python3 -m pip list --format=columns grep docker Babel 2.5.1 |
Docker 5.0.3 is available if I run the same command under root. Sorry I am still learning this and may not know the obvious answer. This is the Ansible command I use to install docker python. However, it is not being made available to the dedicated dockeruser:
|
It should be available anyway. What happens it you use - name: Register Docker user info
become: true
ansible.builtin.user:
name: "{{ docker_user }}"
check_mode: true
register: docker_user_info
- name: Example container block
environment:
XDG_RUNTIME_DIR: "/run/user/{{ docker_user_info.uid }}"
PATH: "{{ docker_user_info.home }}/bin:{{ ansible_env.PATH }}"
DOCKER_HOST: "unix:///run/user/{{ docker_user_info.uid }}/docker.sock"
block:
- name: Nginx container
become: true
become_user: "{{ docker_user }}"
community.docker.docker_container:
name: nginx
image: konstruktoid/nginx
state: started
cap_drop: all
capabilities:
- chown
- dac_override
- net_bind_service
- setgid
- setuid
pull: true
hostname: "{{ ansible_nodename }}"
container_default_behavior: compatibility |
I am getting following error: When I look the error up, its the same thing: Docker Python must be installed. My problem is that even though Docker Python 5.0.3 is installed under root scope. It is not being made available to the dedicated dockeruser. |
|
|
@konstruktoid thank you for the help. The issue was resolved by installing PIP docker using the shell play on my Ansible playbook as follows:
|
Hello, thank you so much for this code. The rootless docker installs fine and docker is available to the dedicated user. I can run docker ps and see there are no containers. However, when I try to deploy the container using Ansible. I am getting the following error:
FAILED! => {"changed": false, "msg": "Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)) on host machine's Python /usr/bin/python3. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter, for example via
pip install dockeror
pip install docker-py(Python 2.6). The error was: No module named 'requests'"}
I have logged into dedicated user and checked version of Python, and everything checks out. Any help would be much appreciated.
The text was updated successfully, but these errors were encountered: