供給された中国および英国のRockchipの源に基づくArmSoMのプラットホームの参照。 実際のボード、SOC、SDK/BSP、カーネル、周辺機器を個別にマッチさせる。これは、ArmSoMボードの全てのサポートを要求しません。 ソース例と測定はArmSoMテストではありません。 コマンドやハードウェアテストは実行されません。
ソースの applicability テーブルは ALL/ALL と言いますが、Docker は記述されたカーネルの機能および配分構成を要求します。
ソースとリスクノート:V1.0.4、保持されるすべての7章、スタンドアローンの技術的な数字はありません。 削除、特権モード、ホストマウント、画像プッシュは、実行されていないソース例です。 safe.directory "*"は、すべてのリポジトリのこの所有権信託チェックを無効にします。それはファイル所有権を譲渡しません。 Source §7.2は、正しく説明しています。これは保持され、フラグが付けられます。 ワイルドカードを使って、盲目に使用しないで信頼できるパスを確認します。 docker login -p は、コマンド引数でパスワードを公開します。歴史的なミラーは統一されています。 出口に変化が失われるソース要求は、コンテナの書き込み可能なレイヤーをイメージから区別しなければなりません。 終了はレイヤー自体を削除しません。
1. . プロフィール {#1-overview}
Docker はオープンソースアプリケーションコンテナエンジンです。 開発者は、アプリケーションと依存性を軽量でポータブルなコンテナにパッケージ化し、システムリソースをより効率的に使用し、一貫性のある運用環境を確保し、継続的なリリースと展開を実現し、将来におけるポーティング、メンテナンス、拡張を容易にすることができます。 検証済みシステムは以下の通りです。
| リリースバージョン | Docker バージョン | イメージの負荷 | ファームウェアビルド |
|---|---|---|---|
| ubuntu 22.04 - ルートを取得する » | 24.0.5 | パス | パス |
| ubuntu 21.10の特長 | 20.10.12 | パス | パス |
| ubuntu 21.04 - ルートを取得する » | 20.10.7 | パス | パス |
| ubuntu 18.04 - ルートを取得する » | 20.10.7 | パス | パス |
| フェドラ35 | 20.10.12 | パス | NR(実行しない) |
2. . インストール {#2-installation}
2.1 Debianベースのディストリビューション、Debian、Ubuntuなど {#21-debian-based-distributions-such-as-debian-ubuntu}
sudo apt-get install docker.io
2.2 Redhatベースのディストリビューション、Redhat、Fedora、CentOSなど {#22-redhat-based-distributions-such-as-redhat-fedora-centos}
sudo yum install docker
sudo dnf install docker
3. . 利用条件 {#3-usage}
3.1 Dockerfile でイメージを作成する {#31-create-an-image-with-a-dockerfile}
# $name:$tag Image name: tag name
# Dockfile is built based on the context, the built directory must contain Dockerfile
# $dockerfile specifies the Dockerfile name, it is PATH/Dockerfile by default
# $dockerfile_dir Dockerfile is located at PATH
sudo docker build -f $dockerfile -t $name:$tag $dockerfile_dir
3.2 イメージまたはコンテナを削除します {#32-delete-an-image-or-container}
# $imageID
sudo docker rmi $imageID
# $containerID
sudo docker rm $containerID
3.3 画像またはコンテナの名前を変更 {#33-rename-image-or-container}
# $imageID: Image ID
# $name:$tag: image name:tag name
sudo docker tag $imageID $name:$tag
# $containerID container ID
# $name container name
sudo docker rename $containerID $name
3.4 画像またはコンテナの確認 {#34-to-check-the-image-or-container}
sudo docker image ls
sudo docker container ls
3.5 の操業 Docker 環境 {#35-run-docker-environment}
# Run Docker environment
# --privileged: privileged mode
# -it: means enabling interactive mode, /bin/bash: means interactive mode
# -v $host_dir:$docker_dir: maps the host directory into Docker
# -p $host_port:$docker_port: maps the host port into Docker
# -u $docker_user: specifies to use the user in Docker to log in
# -w $cwd_dir: switches to the path inside the container
# -d --detach: set background running mode
# Run the specified image
sudo docker run --privileged -it -u $docker_user -v $host_dir:$docker_dir $imageID /bin/bash
# Run the specified container
sudo docker exec -it -w $cwd_dir $containerID /bin/bash
3.6 イメージ管理 {#36-image-management}
# Login to dockerhub account
sudo docker login -u $username -p $password
# Pull the dockerhub image
sudo docker image pull $imageID
# Push image to dockerhub
sudo docker image push $username/$imagename
# Export local image (tar archive file)
sudo docker image save $name:$tag -o ${dockerimage.tar}
# Import local image (tar archive file)
sudo docker image load -i ${dockerimage.tar}
# Change the local immage and commit
# -m commit information
# -a the author of the commit
# $containerID: the container ID which is changed
# $new_name:$new_tag: commited image name tag
sudo docker commit -m $commit_message -a $author $containerID $new_name:$new_tag
4. . DockerでSDKを作成する方法 {#4-how-to-build-sdk-with-docker}
4.1 Docker イメージの作成 {#41-build-docker-image}
Dockerfile を使用したビルド {#411-build-by-using-dockerfile}
# Refer to the Dockerfile provided by this document
# Suppose Dockerfile is in /home/docker/Dockerfile
cd /home/docker
sudo docker build -t docker_rk:latest .
4.1.2 提供イメージを使用する {#412-use-the-provided-image}
Docker のイメージは Docker で利用できます。
4.2 Docker を使って SDK をビルドする {#42-build-sdk-by-using-docker}
# Suppose the SDK is located at /home/user/sdk
# Maps the SDK to the Docker image and enter the image
sudo docker run --privileged -it -u rk -v /home/user/sdk:/home/rk/sdk docker_rk:latest /bin/bash
# Switch to the path in Docker, the compilation method can be check through build.sh -h
cd /home/rk/sdk
./build.sh -h
4.3 Dockerイメージを更新 {#43-update-docker-image}
# After exiting the Docker image, all modifications except the mapping directory will not be saved. If you want to save the corresponding modifications, the Docker image needs to be updated
# Supports the container instantiated by this image is rk@ecbbcdc7e5ca:/$
# Follow the command below to update the Docker image
sudo docker commit -m "update" ecbbcdc7e5ca docker_rk:latest
5. .. RockchipプラットフォームでDockerを実行する方法 {#5-how-to-run-docker-in-rockchip-platform}
5.1 カーネルの設定 {#51-kernel-config}
Dockerを実行するには、カーネルはcgroups、namespace、netfilter、overlayfsなどの機能のサポートを有効にする必要があります。使用する設定がDockerの実行要件を満たしていることを確認してください。 ホストは、既にシステム上で利用できない場合は、スクリプト/usr/share/docker.io/contrib/check-config.shで確認するか、またはcheck-config.shによって取得することができます。 同時に、一般的なドッカー設定を次のコマンドで設定できます。
make ARCH=arm64 rockchip_linux_defconfig rockchip_linux_docker.config
5.2 Buildroot 設定 {#52-buildroot-config}
Buildroot は、ドッカー関連の関数が必要な場合は、ドッカー関連のデフォルトでドッカー関連の構成を有効にしません。次の設定を有効にできます。
BR2_PACKAGE_CGROUPFS_MOUNT=y
BR2_PACKAGE_DOCKER_ENGINE=y
BR2_PACKAGE_DOCKER_ENGINE_EXPERIMENTAL=y
BR2_PACKAGE_DOCKER_ENGINE_STATIC_CLIENT=y
BR2_PACKAGE_DOCKER_ENGINE_DRIVER_BTRFS=y
BR2_PACKAGE_DOCKER_ENGINE_DRIVER_DEVICEMAPPER=y
BR2_PACKAGE_DOCKER_ENGINE_DRIVER_VFS=y
5.3 Debian の設定 {#53-debian-config}
ドッカーはDebianに直接インストールできます。 Debian はデフォルトで iptables-nft を使用することに注意してください。Docker はデフォルトでは iptables-legacy を使用します。そのため、 iptables をレガシーバージョンを使用するように設定する必要があります。次のコマンドで切り替えることができます。
# Using iptables-legacy
update-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
# Using iptables-nft
update-alternatives --set iptables /usr/sbin/iptables-nft
update-alternatives --set ip6tables /usr/sbin/ip6tables-nft
6. .. Dockerfile リファレンス {#6-dockerfile-reference}
FROM ubuntu:22.04
RUN \
# use mirror sources
echo "deb http://mirrors.ustc.edu.cn/ubuntu/ jammy main restricted universe multiverse\n\
deb http://mirrors.ustc.edu.cn/ubuntu/ jammy-security main restricted universe multiverse\n\
deb http://mirrors.ustc.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse\n\
deb http://mirrors.ustc.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse" \
> /etc/apt/sources.list \
# install packages
&& DEBIAN_FRONTEND=noninteractive apt-get update -y \
&& DEBIAN_FRONTEND=noninteractive apt-get upgrade -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
bc binfmt-support bison bsdmainutils build-essential chrpath cmake cpio curl device-tree-compiler diffstat \
expat expect fdisk file flex gawk git iputils-ping libegl1-mesa libelf-dev libgmp-dev libgucharmap-2-90-dev \
liblz4-tool libmpc-dev libncurses-dev libsdl1.2-dev libssl-dev locales live-build mesa-common-dev net-tools \
patchelf python2 python2-dev python3 python-is-python3 python3-git python3-jinja2 python3-pexpect python3-pip \
python3-pyelftools python3-subunit qemu-user-static repo rsync ssh strace swig vim socat sudo texinfo time tree \
unzip wget \
# add user in docker
&& useradd -c 'rk user' -m -d /home/rk -s /bin/bash rk && usermod -a -G sudo rk \
&& sed -i -e '/\%sudo\tALL=(ALL:ALL) ALL/ c \%sudo ALL=(ALL) NOPASSWD: ALL' /etc/sudoers \
&& echo "docker image build complete"
# delete useless package and cache if need
#&& apt-get autoclean && apt-get autoremove && rm -rf /var/lib/apt/lists/*
7. . よくある質問 {#7-faq}
7.1 画像構成を引っ張るエラー: Https を入手:……Read: Peer による接続リセット {#71-error-pulling-image-configuration-get-httpsread-connection-reset-by-peer}
現在のネットワークは、Docker 公式サイトのイメージリポジトリにアクセスできません。 Docker の国内イメージリポジトリの設定でこの問題を解決できます。 下記の変更事項を必ずご参照下さい。
# Add the following content to /etc/docker/daemon.json
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"]
}
7.2 Error.GitError: …… rev-parse: 致命的検出: リポジトリの悪意のある所有権 {#72-errorgiterror–rev-parse-fatal-detected-dubious-ownership-in-repository-at}
通常、リポジトリの所有権は、現在リポジトリをダウンロードしているホストユーザーに属しています。 Docker でコンパイルするとき、 Docker 環境のユーザがリポジトリの所有権を持たないため、コンパイルエラーをトリガーし、次のコマンドですべてのリポジトリの転送を右に変更できます。 Docker のユーザがリポジトリの所有権をとっているとき、Host ホスト ユーザーは、権限転送によるリポジトリの許可も失われます。
git config --global --add safe.directory "*"
ソース参照リンク
https://git-scm.com/docs/git-config#Documentation/git-config.txt-safedirectory
https://console.zbox.filez.com/l/boc1y7
https://github.com/moby/moby/blob/master/contrib/check-config.sh
