LoginSignup
1
0

More than 1 year has passed since last update.

箱庭もくもく会 #9

いろいろやってみて、自分が今やりたいことは何かは明確になった。

仮想戦略会議「箱庭」

素のdocker 上の ubuntu上だけで箱庭を構築したい。

gccを使う必要があれば、公式gcc docker上で構築したい。

背景

OSにはあまり興味がありません。専門は通信プロトコルで、通信を実現する論理回路と言語にはとても興味がありあます。OSは、OSのことを何も知らなくてもプログラミングできるサービスを提供するものだと理解しています。プログラミング言語は、できればCPUのことを何もしらなくてもプログラミングできるような仕組みだと嬉しいかもしれない。

dockerでは、Anaconda公式を利用したりgcc公式を利用してきた。
clangを利用しようとしたら、clang公式がなく、素のubuntuまたはgcc公式に導入することにした。

dockerにclang

あなたもdocker, 私もdocker。docker(130)

docker上でdockerが利用したいのは、mac OS上のdockerとWindows上のdockerの振る舞いが違うとか関係したくないからかも。結果として影響を受けるとしたら、影響を受けない仕組みが作れないのかどうか。

見通し

scriptファイルの中身をたたいていけば、どうしたらいいかがわかるんだろう。

build-app.bash
#!/bin/bash

if [ $# -ne 1 ]
then
	echo "Usage: $0 [<apl-name>|clean]"
	exit 1
fi

if [ $1 != "clean" ]
then
    docker exec -it -e APLNAME=$1 -w /root/workspace/sdk/workspace \
        hakoniwa_single-robot /bin/bash -c 'make img=${APLNAME}'
else
    docker exec -it -e APLNAME=$1 -w /root/workspace/sdk/workspace \
        hakoniwa_single-robot /bin/bash -c 'make clean'
fi

作業記録

bash
$ git clone --recursive -b v1.1.2 https://github.com/toppers/hakoniwa-ros2sim.git
Cloning into 'hakoniwa-ros2sim'...
remote: Enumerating objects: 2043, done.
remote: Counting objects: 100% (632/632), done.
remote: Compressing objects: 100% (295/295), done.
remote: Total 2043 (delta 307), reused 616 (delta 305), pack-reused 1411
Receiving objects: 100% (2043/2043), 20.16 MiB | 11.35 MiB/s, done.
Resolving deltas: 100% (1000/1000), done.
Note: switching to '3efc6bc2f4e18b8b7496b100cc393cedc56f20e7'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

Updating files: 100% (1442/1442), done.
Submodule 'third-party/ros2/ros_tcp_endpoint' (https://github.com/Unity-Technologies/ROS-TCP-Endpoint.git) registered for path 'third-party/ros2/ros_tcp_endpoint'
Cloning into '/Users/ogawakiyoshi/hakoniwa/hakoniwa-ros2sim/third-party/ros2/ros_tcp_endpoint'...
remote: Enumerating objects: 1314, done.        
remote: Counting objects: 100% (532/532), done.        
remote: Compressing objects: 100% (224/224), done.        
remote: Total 1314 (delta 375), reused 349 (delta 298), pack-reused 782        
Receiving objects: 100% (1314/1314), 381.54 KiB | 3.67 MiB/s, done.
Resolving deltas: 100% (726/726), done.
Submodule path 'third-party/ros2/ros_tcp_endpoint': checked out '54c1a64b6d5ef6ffa0a0431570bb74329b79b15b'
# cd hakoniwa-ros2sim
$ bash docker/pull-image.bash
v1.1.2: Pulling from toppersjp/hakoniwa-ros2sim
d5fd17ec1767: Pull complete 
ca43c78a9071: Pull complete 
695af473b1cd: Pull complete 
20ecbdd5d86a: Pull complete 
184a755bf529: Pull complete 
9c4352d7e259: Pull complete 
ea0e9bbed1d0: Pull complete 
65bf8fe27777: Pull complete 
a7e4758ada80: Pull complete 
34a8c9291c75: Pull complete 
7686189d3c32: Pull complete 
df093948cd96: Pull complete 
e02032be294d: Pull complete 
e6d937189eb7: Pull complete 
e11b48abe2bb: Pull complete 
df42c8d95d87: Pull complete 
4f4fb700ef54: Pull complete 
5466f4f9a076: Pull complete 
53e23772a3cd: Pull complete 
08dcacb24c4b: Pull complete 
ed6a46cb4039: Pull complete 
e6ceccddbc71: Pull complete 
e1ab1560f07c: Pull complete 
Digest: sha256:aed6e5cdd00de43322a815e4d381f185c32d606bd6638c27f814169884f26f5e
Status: Downloaded newer image for toppersjp/hakoniwa-ros2sim:v1.1.2
docker.io/toppersjp/hakoniwa-ros2sim:v1.1.2
$ bash docker/run.bash en1
Unable to find image '10000:10000' locally
docker: Error response from daemon: pull access denied for 10000, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
$ bash docker/attach.bash
"docker exec" requires at least 2 arguments.
See 'docker exec --help'.

Usage:  docker exec [OPTIONS] CONTAINER COMMAND [ARG...]

Run a command in a running container

他のdocker作業をしていて、docker loginはすでにしているはず。
今日の作業はここまで。下のいろいろ含めて8:40になりました。

bash
$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
4bbe4aab0054        gcc                 "/bin/bash"         6 days ago          Up 6 days                               busy_carson
0fcb7a4b6437        ubuntu              "/bin/bash"         7 days ago          Up 7 days                               optimistic_hellman
bf8731413973        ubuntu              "/bin/bash"         8 days ago          Up 8 days                               festive_williamson
$ docker images
REPOSITORY                   TAG                 IMAGE ID            CREATED              SIZE
kaizenjapan/sagyouchu2       latest              1b137b0bb2fc        About a minute ago   247MB
kaizenjapan/sagyouchu        latest              2788873e3785        2 minutes ago        247MB
kaizenjapan/cppn5910         latest              6923942cdca7        31 hours ago         2.13GB
gcc                          latest              3f8e26ab44a6        3 weeks ago          1.27GB
toppersjp/hakoniwa-ros2sim   v1.1.2              a09fbde4c0d0        6 weeks ago          1.58GB
kaizenjapan/mochizuki        latest              71709c3a2ec3        8 weeks ago          257MB
kaizenjapan/mochizuki        <none>              0c83400ca632        2 months ago         236MB
<none>                       <none>              c7ea53dc79ce        2 months ago         236MB
kaizenjapan/wi-fi            latest              563d904a7555        4 months ago         439MB
kaizenjapan/ethernet         latest              99cd228aede1        4 months ago         214MB
ubuntu                       latest              54c9d81cbb44        4 months ago         72.8MB
auchida/freebsd              latest              7aac0f9397f9        5 years ago          505MB

どれもportは使っていない。

bash
# git clone -b v1.3.1 https://github.com/toppers/hakoniwa-single_robot.git
Cloning into 'hakoniwa-single_robot'...
remote: Enumerating objects: 878, done.
remote: Counting objects: 100% (106/106), done.
remote: Compressing objects: 100% (75/75), done.
remote: Total 878 (delta 46), reused 52 (delta 27), pack-reused 772
Receiving objects: 100% (878/878), 2.40 MiB | 4.41 MiB/s, done.
Resolving deltas: 100% (416/416), done.
Note: switching to '419602834b059e25a7aadde60de5495efed06223'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false
git clone --recursive -b v1.1.2 https://github.com/toppers/hakoniwa-ros2sim.git

Cloning into 'hakoniwa-ros2sim'...
remote: Enumerating objects: 2043, done.
remote: Counting objects: 100% (632/632), done.
remote: Compressing objects: 100% (296/296), done.
remote: Total 2043 (delta 306), reused 616 (delta 304), pack-reused 1411
Receiving objects: 100% (2043/2043), 20.16 MiB | 9.28 MiB/s, done.
Resolving deltas: 100% (999/999), done.
Note: switching to '3efc6bc2f4e18b8b7496b100cc393cedc56f20e7'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

Updating files: 100% (1442/1442), done.
Submodule 'third-party/ros2/ros_tcp_endpoint' (https://github.com/Unity-Technologies/ROS-TCP-Endpoint.git) registered for path 'third-party/ros2/ros_tcp_endpoint'
Cloning into '/home/hakoniwa/hakoniwa-ros2sim/third-party/ros2/ros_tcp_endpoint'...
remote: Enumerating objects: 1314, done.        
remote: Counting objects: 100% (532/532), done.        
remote: Compressing objects: 100% (226/226), done.        
remote: Total 1314 (delta 375), reused 347 (delta 296), pack-reused 782        
Receiving objects: 100% (1314/1314), 381.56 KiB | 2.76 MiB/s, done.
Resolving deltas: 100% (726/726), done.
Submodule path 'third-party/ros2/ros_tcp_endpoint': checked out '54c1a64b6d5ef6ffa0a0431570bb74329b79b15b'
bash: Docker: command not found
bash: $'\346\234\254\343\202\267\343\203\237\343\203\245\343\203\254\343\203\274\343\202\277\343\201\247\343\201\257': command not found
bash: $'\345\256\237\351\250\223\347\232\204\343\201\253\343\203\215\343\202\244\343\203\206\343\202\243\343\203\226\343\201\256Linux\347\222\260\345\242\203\357\274\210WSL2\345\220\253\343\202\200\357\274\211\343\201\247\343\201\256\345\213\225\344\275\234\343\202\222\350\251\246\350\241\214\343\201\227\343\201\246\343\201\204\343\201\276\343\201\231\357\274\216\343\203\215\343\202\244\343\203\206\343\202\243\343\203\226\347\222\260\345\242\203\343\201\247\343\201\256\345\213\225\344\275\234\346\211\213\351\240\206\343\201\257': command not found
bash: Mac: command not found
bash: Docker: command not found
bash: Windows/WSL2: No such file or directory
bash: Docker: command not found
bash: $: command not found
bash: /usr/bin/docker: No such file or directory
bash: [: missing `]'
bash: $: command not found
bash: hakoniwa-ros2sim: command not found
bash: Docker: command not found
bash: Docker: command not found
bash: $'\344\270\213\350\250\230\343\201\256\343\202\210\343\201\206\343\201\253\345\256\237\350\241\214\343\201\227\343\201\246\343\201\217\343\201\240\343\201\225\343\201\204\357\274\216': command not found
bash: utils/install-docker.bash: No such file or directory
docker: unrecognized service
docker: unrecognized service
bash: $'\346\254\241\343\201\256\343\202\210\343\201\206\343\201\253\345\207\272\345\212\233\343\201\225\343\202\214\343\201\246\343\201\204\343\202\214\343\201\260\357\274\214Docker\343\201\214\350\265\267\345\213\225\343\201\227\343\201\246\343\201\204\343\201\276\343\201\231\357\274\216': command not found
bash: hakoniwa-ros2sim: command not found
bash: $'\343\201\276\343\201\237\357\274\214\343\203\246\343\203\274\343\202\266\343\201\214': command not found
gpasswd: user 'docker' does not exist
chgrp: invalid group: 'docker'
docker: unrecognized service
bash: $'\344\270\212\350\250\230\343\201\256\343\202\263\343\203\236\343\203\263\343\203\211\345\256\237\350\241\214\347\265\220\346\236\234\343\201\257\357\274\214\343\202\277\343\203\274\343\203\237\343\203\212\343\203\253\343\201\253\345\206\215\343\203\255\343\202\260\343\202\244\343\203\263\343\201\227\343\201\246\343\201\213\343\202\211\346\234\211\345\212\271\343\201\250\343\201\252\343\202\212\343\201\276\343\201\231\357\274\216': command not found
bash: Unity: command not found
bash: Unity: command not found
bash: Unity: command not found
bash: Unity: command not found
bash: $'\343\202\267\343\203\237\343\203\245\343\203\254\343\203\274\343\202\277\343\201\256\345\260\216\345\205\245\346\211\213\351\240\206': command not found
bash: $'Docker\343\202\244\343\203\241\343\203\274\343\202\270\343\201\256\345\261\225\351\226\213': command not found
bash: $'\343\202\267\343\203\237\343\203\245\343\203\254\343\203\274\343\202\277\343\201\256\345\256\237\350\241\214\347\222\260\345\242\203\343\201\257\357\274\214\343\203\223\343\203\253\343\203\211\346\270\210\343\201\277\343\201\256Docker': command not found
bash: https://hub.docker.com/r/toppersjp/hakoniwa-ros2sim: No such file or directory
bash: $'\346\254\241\343\201\256\343\202\263\343\203\236\343\203\263\343\203\211\343\202\222\345\256\237\350\241\214\343\201\227\343\201\246\343\201\217\343\201\240\343\201\225\343\201\204\357\274\216Docker\343\202\244\343\203\241\343\203\274\343\202\270\343\201\256\343\201\256pull\343\201\250\345\261\225\351\226\213\343\202\222\350\241\214\343\201\204\343\201\276\343\201\231\357\274\216': command not found
bash: docker/pull-image.bash: No such file or directory
bash: $'[\350\243\234\350\266\263\357\274\232\351\226\213\347\231\272\350\200\205\345\220\221\343\201\221\346\203\205\345\240\261]': command not found
bash: $'docker\343\202\222\350\265\267\345\213\225\343\201\231\343\202\213': command not found
bash: $'\343\202\277\343\203\274\343\203\237\343\203\212\343\203\253\343\202\2222\345\200\213\350\265\267\345\213\225\343\201\227\343\201\276\343\201\231\357\274\210\344\273\245\351\231\215\343\201\256\350\252\254\346\230\216\343\201\247\343\201\257\357\274\214\343\202\277\343\203\274\343\203\237\343\203\212\343\203\253A\343\201\212\343\202\210\343\201\263\343\202\277\343\203\274\343\203\237\343\203\212\343\203\253B\343\201\250\345\221\274\343\201\263\343\201\276\343\201\231\357\274\211\357\274\216': command not found
bash: $'\343\202\277\343\203\274\343\203\237\343\203\212\343\203\253A\343\201\247docker\343\202\263\343\203\263\343\203\206\343\203\212\343\202\222\350\265\267\345\213\225\343\201\227\343\201\276\343\201\231\357\274\216': command not found
bash: docker/run.bash: No such file or directory
bash: $'Mac\347\222\260\345\242\203\343\201\256\345\240\264\345\220\210\343\201\257\357\274\214\343\203\215\343\203\203\343\203\210\343\203\257\343\203\274\343\202\257\343\203\235\343\203\274\343\203\210\345\220\215\357\274\210\344\276\213\357\274\232en0\357\274\211\343\202\222\345\274\225\346\225\260\343\201\253\346\214\207\345\256\232\343\201\231\343\202\213\345\277\205\350\246\201\343\201\214\343\201\202\343\202\212\343\201\276\343\201\231\357\274\216': command not found
bash: syntax error near unexpected token `newline'
bash: $'\350\265\267\345\213\225\343\201\227\343\201\237': command not found
bash: Unity: command not found
bash: Unity: command not found
bash: 場所:ros2/unity/tb3: No such file or directory
bash: $'\350\265\267\345\213\225\343\201\231\343\202\213\343\201\250\357\274\214\344\273\245\344\270\213\343\201\256\347\224\273\351\235\242\343\201\214\350\241\250\347\244\272\343\201\225\343\202\214\343\201\276\343\201\231\357\274\216': command not found
bash: この状態で、画面左下にある「プロジェクトビュー」の「Assets/Scenes」を選択すると、画面下に「Toppers_Course」というシーンがありますので,これをダブルクリックしましょう.: No such file or directory
bash: $'\344\273\245\344\270\213\343\201\256\343\202\210\343\201\206\343\201\253\343\202\263\343\203\274\343\202\271\343\201\214\350\241\250\347\244\272\343\201\225\343\202\214\343\201\276\343\201\231\357\274\216': command not found
bash: $'\343\202\267\343\203\237\343\203\245\343\203\254\343\203\274\343\202\277\343\201\256\345\256\237\350\241\214\346\211\213\351\240\206': command not found
bash: $'\346\254\241\343\201\256\345\257\276\350\261\241\343\202\222\344\276\213\351\241\214\343\201\250\343\201\227\343\201\246\345\256\237\350\241\214\346\211\213\351\240\206\343\202\222\350\252\254\346\230\216\343\201\227\343\201\276\343\201\231\357\274\216': command not found
bash: ROS: command not found
bash: $'Unity\345\201\264\343\201\256\343\203\255\343\203\234\343\203\203\343\203\210\357\274\232TB3RoboModel': command not found
bash: $'\346\272\226\345\202\231': command not found
bash: $'\343\202\277\343\203\274\343\203\237\343\203\212\343\203\253A\343\201\250B\343\201\256\344\270\241\346\226\271\343\201\247\343\201\247docker\343\202\263\343\203\263\343\203\206\343\203\212\343\201\253\345\205\245\343\202\212\343\201\276\343\201\231\357\274\216': command not found
bash: $'\343\202\277\343\203\274\343\203\237\343\203\212\343\203\253A\343\201\247': command not found
bash: docker/run.bash: No such file or directory
bash: $'\343\202\277\343\203\274\343\203\237\343\203\212\343\203\253B\345\201\264\343\201\257\357\274\214\344\273\245\344\270\213\343\201\256\343\202\263\343\203\236\343\203\263\343\203\211\343\201\247\345\205\245\343\202\212\343\201\276\343\201\231\357\274\216': command not found
bash: docker/attach.bash: No such file or directory
bash: $'\343\202\277\343\203\274\343\203\237\343\203\212\343\203\253A\343\201\247\343\201\256\346\223\215\344\275\234': command not found
bash: $'\343\202\277\343\203\274\343\203\237\343\203\212\343\203\253A\343\201\247ROS-TCP-ENDPOINT\343\202\222\350\265\267\345\213\225\343\201\227\343\201\276\343\201\227\343\202\207\343\201\206\357\274\216': command not found
bash: $'\343\202\277\343\203\274\343\203\237\343\203\212\343\203\253B\343\201\247\343\201\256\346\223\215\344\275\234': command not found
bash: $'\343\202\277\343\203\274\343\203\237\343\203\212\343\203\253B\343\201\247ROS2\343\203\227\343\203\255\343\202\260\343\203\251\343\203\240\343\202\222\350\265\267\345\213\225\343\201\227\343\201\276\343\201\227\343\202\207\343\201\206\357\274\216': command not found
bash: $'Unity\343\201\256\343\202\267\343\203\237\343\203\245\343\203\254\343\203\274\343\202\267\343\203\247\343\203\263\351\226\213\345\247\213\343\201\231\343\202\213': command not found
bash: $'Unity\343\201\256\343\202\267\343\203\237\343\203\245\343\203\254\343\203\274\343\202\267\343\203\247\343\203\263\351\226\213\345\247\213\343\203\234\343\202\277\343\203\263\343\202\222\343\202\257\343\203\252\343\203\203\343\202\257\343\201\231\343\202\213\343\201\250\357\274\214\344\273\245\344\270\213\343\201\256\350\265\267\345\213\225\347\224\273\351\235\242\343\201\214\345\207\272\343\201\246\343\201\215\343\201\276\343\201\231\357\274\216': command not found
bash: $'\343\201\223\343\201\256\347\212\266\346\205\213\343\201\247\357\274\214Unity\345\201\264\343\201\256\343\200\214\351\226\213\345\247\213\343\200\215\343\203\234\343\202\277\343\203\263\343\202\222\343\202\257\343\203\252\343\203\203\343\202\257\343\201\231\343\202\213\343\201\250\347\256\261\345\272\255\343\201\256\343\202\267\343\203\237\343\203\245\343\203\254\343\203\274\343\202\267\343\203\247\343\203\263\351\226\213\345\247\213\343\201\227\357\274\214TurtleBot3\343\201\214\345\213\225\343\201\215\345\207\272\343\201\227\343\201\276\343\201\231\357\274\216': command not found
bash: $'\345\213\225\344\275\234\344\276\213': command not found
bash: $'\345\213\225\344\275\234\344\276\213': command not found
bash: $'\343\201\223\343\201\256\345\213\225\347\224\273\343\201\256\345\220\204\343\202\246\343\202\243\343\203\263\343\203\211\343\202\246\343\201\257\357\274\214\343\201\235\343\202\214\343\201\236\343\202\214\346\254\241\343\201\256\351\200\232\343\202\212\345\257\276\345\277\234\343\201\227\343\201\246\343\201\204\343\201\276\343\201\231\357\274\216': command not found
bash: $'\345\217\263\344\270\212\357\274\232\343\202\277\343\203\274\343\203\237\343\203\212\343\203\253A': command not found
bash: $'\345\217\263\344\270\213\357\274\232\343\202\277\343\203\274\343\203\237\343\203\212\343\203\253B': command not found
bash: $'\345\267\246\357\274\232Unity': command not found
bash: Contributing: command not found
bash: $'\346\234\254\343\203\252\343\203\235\343\202\270\343\203\210\343\203\252\343\201\247\345\205\254\351\226\213\343\201\227\343\201\246\343\201\204\343\202\213\343\200\214\347\256\261\345\272\255': command not found
bash: TODO: command not found
bash: syntax error near unexpected token `newline'
bash: $'\350\254\235\350\276\236': command not found
bash: TurtleBot3: command not found
bash: TurtleBot3: command not found
bash: $'\343\203\251\343\202\244\343\202\273\343\203\263\343\202\271': command not found
bash: $'TOPPERS\343\203\251\343\202\244\343\202\273\343\203\263\343\202\271\343\201\247\345\205\254\351\226\213\343\201\227\343\201\246\343\201\204\343\201\276\343\201\231\357\274\216': command not found
bash: $'\350\221\227\344\275\234\346\250\251\350\200\205\343\201\257TOPP': command not found

参考資料

Docker in Docker のベタープラクティス

Dockerコンテナ内からDockerを使うことについて

自己参照

今日のdocker 作業

docker 共有フォルダをどこに置くか (macOS編)

あなたもdocker, 私もdocker。docker(130)

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0