やってみる

アウトプットすべく己を導くためのブログ。その試行錯誤すらたれ流す。

DockerHubからラズパイ用Giterを探してrunする

 2018-09-14時点。

DockerHubからラズパイ用Giterを探す

 https://hub.docker.com/r/phreakazoid/gitea-rpi/ を使う。

前提

docker run

$ docker run -it --name phreakazoid-gitea-rpi_test_20180914 phreakazoid/gitea-rpi
$ docker run -it --name phreakazoid-gitea-rpi_test_20180914 phreakazoid/gitea-rpi
Unable to find image 'phreakazoid/gitea-rpi:latest' locally
latest: Pulling from phreakazoid/gitea-rpi
96598928ae71: Pull complete 
3d404b836ac0: Pull complete 
6b501168cd1e: Pull complete 
a1d37c34e6b7: Pull complete 
b2d19f1cd8e1: Pull complete 
21162a6fc6e4: Pull complete 
20dbda286dd8: Pull complete 
bc198370222f: Pull complete 
013ea85fb29b: Pull complete 
7e0988ee6ed5: Pull complete 
449ba47bb252: Pull complete 
ad99d37c8081: Pull complete 
2792bd48020f: Pull complete 
df984e75c0a7: Pull complete 
3b8f486767f2: Pull complete 
ae98cc5d21c2: Pull complete 
Digest: sha256:5a55e175fc9982e751a10a916abc495198e2908ab702d3cb6b13bf4d5d5ce072
Status: Downloaded newer image for phreakazoid/gitea-rpi:latest
Generating /data/ssh/ssh_host_ed25519_key...
Sep 14 08:27:49 syslogd started: BusyBox v1.26.2
Generating /data/ssh/ssh_host_rsa_key...
2018/09/14 08:27:53 [T] Custom path: /data/gitea
2018/09/14 08:27:53 [T] Log path: /data/gitea/log
2018/09/14 08:27:53 [I] Log Mode: Console(Trace)
2018/09/14 08:27:53 [I] XORM Log Mode: Console(Trace)
2018/09/14 08:27:53 [I] Cache Service Enabled
2018/09/14 08:27:53 [I] Session Service Enabled
2018/09/14 08:27:53 [I] SQLite3 Supported
2018/09/14 08:27:53 [I] Run Mode: Development
2018/09/14 08:27:53 [I] Gitea v1.1.2 built with: bindata, sqlite
2018/09/14 08:27:54 [I] Listen: http://0.0.0.0:3000
2018/09/14 08:27:54 Serving [::]:3000 with pid 15
Generating /data/ssh/ssh_host_dsa_key...
Generating /data/ssh/ssh_host_ecdsa_key...
/etc/ssh/sshd_config line 32: Deprecated option UsePrivilegeSeparation
Sep 14 08:27:58 sshd[16]: Server listening on :: port 22.
Sep 14 08:27:58 sshd[16]: Server listening on 0.0.0.0 port 22.

 サーバが起動たっぽい。http://0.0.0.0:3000を参照しても何も表示されなかった。これどうやって使うの?

  • http://0.0.0.0:3000
  • http://0.0.0.0:22
  • http://localhost:3000/
  • http://localhost:22

 Ctrl+C, Ctrl+Xで強制終了。

 イメージとコンテナ確認。できてる。

$ docker images
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
phreakazoid/gitea-rpi   latest              92d4104e2cf1        14 months ago       97.1MB
$ docker ps -a
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS                          PORTS               NAMES
efb3f538124e        phreakazoid/gitea-rpi        "/usr/bin/entrypoint…"   7 minutes ago       Exited (0) About a minute ago                       phreakazoid-gitea-rpi_test_20180914

 こちらを参考に以下のコマンドを打つ。

$ docker run -d \
  --restart=always \
  --name=gitea-arm \
  -p 22:22 \
  -p 3000:3000 \
  -v /opt/gitea:/data \
  phreakazoid/gitea-rpi:latest

 ブラウザのURL欄にhttp://0.0.0.0:3000を入力すると以下インストール画面が表示された。

f:id:ytyaru:20180914182139p:plain

 DBにSQLiteを選べば使えると思われる。でも本格的に使うならMySQLやPostgleSQLを使いたい。

 次回、SQLiteでインストールしてみる。

補足

 docker runを何度かやり直すと次のようなことになった。参考までに残しておく。

 実行するとエラーになった。コンテナ名の重複が原因。

$ docker run -d \
>   --restart=always \
>   --name=gitea-arm \
>   --link mariadb:mysql \
>   -p 22:22 \
>   -p 3000:3000 \
>   -v /opt/gitea:/data \
>   phreakazoid/gitea-rpi:1.1.2
Unable to find image 'phreakazoid/gitea-rpi:1.1.2' locally
1.1.2: Pulling from phreakazoid/gitea-rpi
96598928ae71: Already exists 
3d404b836ac0: Already exists 
6b501168cd1e: Already exists 
a1d37c34e6b7: Already exists 
b2d19f1cd8e1: Already exists 
21162a6fc6e4: Already exists 
20dbda286dd8: Already exists 
bc198370222f: Already exists 
013ea85fb29b: Already exists 
7e0988ee6ed5: Already exists 
0dac18680015: Pull complete 
c6646f362ed6: Pull complete 
f5421b4c8394: Pull complete 
e30932541c2d: Pull complete 
b1c8ba97ec9b: Pull complete 
c2605fde140a: Pull complete 
Digest: sha256:b9483b395aaed16a029e8d5695c79b95dabcc94a1c467678f961c940d393d61e
Status: Downloaded newer image for phreakazoid/gitea-rpi:1.1.2
docker: Error response from daemon: Conflict. The container name "/gitea-arm" is already in use by container "4461250d753dcb6da3abee850e1aa4ca2edde758b8672af6c9d216d1e976de40". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.

 対象コンテナを削除しようとするがエラー。

$ docker rm gitea-arm
Error response from daemon: You cannot remove a running container 4461250d753dcb6da3abee850e1aa4ca2edde758b8672af6c9d216d1e976de40. Stop the container before attempting removal or force remove

 サービスを停止する。

$ docker stop gitea-arm
gitea-arm

 再び削除。できた。

$ docker rm gitea-arm
gitea-arm