Raspberry Pi installation docker

2019/11/11, raspberry pie 4B, Raspbian Buster, Docker 19.03.4

Abstract: Raspberry Pi Raspbian Buster installed Docker, Dockerfile change source software

Installation docker

Download the installation script:

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

Use Ali cloud images to download and install:

sh get-docker.sh --mirror Aliyun

After the execution of the script will automatically recognize the arm architecture, download and install the corresponding version of the docker, wait a moment to

The current user to join docker Group:

sudo usermod -aG docker $USER

Exit the current terminal and log in again, this time operation docker no longer need to add sudo privileges

Note:
Raspberry Pi is the arm architecture, so you can not use a mirror x86 platform, when using the docker pull pull, docker will automatically go to find whether there is a mirror image of matching architecture based on the current framework, so, if it is self-mirroring, you need to sub-platform compiler

Installation docker-compose

Because the tree is a plum pie arm architecture, docker-compose is no official binaries, so we have to use the python pip tool to install docker-compose
update apt source software:

sudo apt-get update

Install python and pip:

sudo apt-get install -y python python-pip

Installation libffi-dev, otherwise in the installation of docker-compose the incorrect report:

sudo apt-get install -y libffi-dev

Use pip install docker-compose, temporary use of software source USTC:

sudo pip install docker-compose -i https://pypi.mirrors.ustc.edu.cn/simple/  --trusted-host  pypi.mirrors.ustc.edu.cn

After installation is complete, if you do not find the command prompt docker-compose ssl_match_hostname:

the need to python2.7 (which specific version can be seen from the figure out) the dist-packages folder to the working directory docker:

sudo cp -r /usr/local/lib/python2.7/dist-packages/backports /usr/local/lib/python2.7/dist-packages/docker/transport/

docker source software mirroring changes

When building mirroring raspberry pie docker, if you want to change the image source software, using the case are as follows:

FROM mcr.microsoft.com/dotnet/core/aspnet:3.0
#安装ffmpeg工具
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list \
    && apt-get update \
    && apt-get install -y ffmpeg \
    && apt-get clean && apt-get autoclean && apt-get autoremove \
    && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY ./publish/ /app 
#默认就是80端口,如果要别的端口,代码中要明确指定监听端口号
EXPOSE 80
EXPOSE 443
ENTRYPOINT ["dotnet","WebMvc.dll"]

Guess you like

Origin www.cnblogs.com/kasnti/p/11833778.html