目录

树莓派 Docker

树莓派

1 pi and docker

1.1 install

curl -fsSL https://get.docker.com -o get-docker.sh

sh get-docker.sh --mirror Aliyun

sudo usermod -aG docker $USER

1.2 安装docker-compose

sudo apt-get update
sudo apt-get install -y python python-pip
sudo apt-get install -y libffi-dev

-w715

sudo usermod -aG docker pi
sudo apt-get update
sudo apt-get install -y python python-pip
sudo apt-get install -y libffi-dev
sudo pip install docker-compose
#sudo pip install docker-compose -i https://pypi.mirrors.ustc.edu.cn/simple/  --trusted-host  pypi.mirrors.ustc.edu.cn

【ERROR】
Command "/usr/bin/python -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-re7IWF --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.mirrors.ustc.edu.cn/simple/ --extra-index-url https://www.piwheels.org/simple --trusted-host pypi.mirrors.ustc.edu.cn -- setuptools>=40.8.0 wheel "cffi>=1.1; python_implementation != 'PyPy'"" failed with error code 1 in None
【解决方案】
sudo apt-get install -y libffi-dev

-w713

【ERROR】
pi-raspberrypi  ➜  ~ docker-compose version
Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 6, in <module>
    from compose.cli.main import main
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 18, in <module>
    import docker.errors
  File "/usr/local/lib/python2.7/dist-packages/docker/__init__.py", line 2, in <module>
    from .api import APIClient
  File "/usr/local/lib/python2.7/dist-packages/docker/api/__init__.py", line 2, in <module>
    from .client import APIClient
  File "/usr/local/lib/python2.7/dist-packages/docker/api/client.py", line 10, in <module>
    from .build import BuildApiMixin
  File "/usr/local/lib/python2.7/dist-packages/docker/api/build.py", line 6, in <module>
    from .. import auth
  File "/usr/local/lib/python2.7/dist-packages/docker/auth.py", line 9, in <module>
    from .utils import config
  File "/usr/local/lib/python2.7/dist-packages/docker/utils/__init__.py", line 3, in <module>
    from .decorators import check_resource, minimum_version, update_headers
  File "/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py", line 4, in <module>
    from . import utils
  File "/usr/local/lib/python2.7/dist-packages/docker/utils/utils.py", line 13, in <module>
    from .. import tls
  File "/usr/local/lib/python2.7/dist-packages/docker/tls.py", line 5, in <module>
    from .transport import SSLHTTPAdapter
  File "/usr/local/lib/python2.7/dist-packages/docker/transport/__init__.py", line 3, in <module>
    from .ssladapter import SSLHTTPAdapter
  File "/usr/local/lib/python2.7/dist-packages/docker/transport/ssladapter.py", line 23, in <module>
    from backports.ssl_match_hostname import match_hostname
ImportError: No module named ssl_match_hostname

【解决方案】
sudo cp -r /usr/local/lib/python2.7/dist-packages/backports /usr/local/lib/python2.7/dist-packages/docker/transport/

-w1060

【ERROR】
Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 6, in <module>
    from compose.cli.main import main
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 52, in <module>
    from .formatter import ConsoleWarningFormatter
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/formatter.py", line 15, in <module>
    from backports.shutil_get_terminal_size import get_terminal_size
ImportError: No module named shutil_get_terminal_size

【解决方案】
sudo apt install ipython

-w656

sudo systemctl enable docker
sudo systemctl start docker
sudo docker version

-w694