# 다음과 같이 ansible 로 docker 처리를 하는 경우
- name: ysoftman docker build
docker_image:
path: "/home/ysoftman/testdocker"
name: "/ysofmtan/testdocker"
tag: "test"
state: build
force: yes
# python 용 docker sdk 를 찾을 수 없다는 에러가 발생한다.
MSG:
Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)) on xxxxx's Python /usr/bin/python. 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 docker` or `pip install docker-py` (Python 2.6). The error was: No module named parse
# python 2.7.5 이라
ansible --version | command grep python
ansible python module location = /usr/lib/python2.7/site-packages/ansible
python version = 2.7.5 (default, Nov 16 2020, 22:23:17) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
# docker 패키지를 설치했다.
sudo pip install docker
# 설치 확인
pip list | grep docker
10:docker (5.0.0)
# 설치해도 똑같은 에러가 발생한다.
# 혹시나 해서 docker-py 를 설치하면
sudo pip install docker-py
# 2개를(docker, docker-py)를 설치하면 안된다는 에러가 발생한다.
Cannot have both the docker-py and docker python modules (old and new version of Docker SDK for Python) installed together as they use the same namespace and cause a corrupt installation. Please uninstall both packages, and re-install only the docker-py or docker python module (for xxxxx's Python /usr/bin/python). It is recommended to install the docker module if no support for Python 2.6 is required. Please note that simply uninstalling one of the modules can leave the other module in a broken state.
# 둘다 지워 보자.
sudo pip uninstall docker docker-py
# 역시 위 첫번째 에러가 발생한다.
# 혹시나 해서 docker-py 만 설치해봤다.
sudo pip install docker-py
# 설치 확인
pip list | grep docker
10:docker-py (1.10.6)
# 에러가 발생 안한다. 뭐지? python 2.7 은 docker 패키지를 설치,
# python 2.6 은 docker-py 를 설치해야만 되는줄 알았는데,흠.
comments:
댓글 쓰기