結論から言うと、なんのことはなくUbuntuにインストールするのと同じです。
Dockerをインストール
Install Docker Engine on Debian | Docker Documentation に従って、インストールします。 普段fish-shellを使っています。 読み替えが面倒臭いので、各コマンドはbashで実行しました。
2回目のapt-get update
をすると、次のようなエラーが出ます。
Err:7 https://download.docker.com/linux/debian focal Release 404 Not Found [IP: 13.249.170.87 443]
deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian focal stable
を
deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu eoan stable
に変えると良さそうです。 動作確認します。
ledsun@MSI:~►sudo docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 2db29710123e: Pull complete Digest: sha256:bfea6278a0a267fad2634554f4f0c6f31981eea41c553fdf5a83e95a41d40c38 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
動きました!
sudo
を要らなくするおまじないをします。
sudo usermod -aG docker ledsun
シェルを起動し直さないと反映されません。
そのままのターミナルでdocker-compose
コマンドを実行して、権限エラーを出して、時間を無駄にしました。
Docker Composeのインストール
Install Docker Compose | Docker Documentation に従って、インストールします。
docker-composeでお目当てのコンテナを起動しました。
ledsun@MSI:~/pubannotation►sudo docker-compose up Creating network "pubannotation_default" with the default driver Creating pubannotation_redis_1 ... Creating pubannotation_db_1 ... Creating pubannotation_db_1 ... error WARNING: Host is already in use by another container ERROR: for pubannotation_db_1 Cannot start service db: driver failed programming external connectivity on endpoint pubannotation_db_1 (1ac1d94f2bb6b6916c07908b0650b89686b7a91354bb2834e9e3155644fddf03): Error starting userland proxy: listen tcp 0.0.0.0:5432: bind: address already in use Creating pubannotation_elasticsearch_1 ... error Creating pubannotation_redis_1 ... done csearch_1 (66ba56873f80c2536192a2b9a22829ec83515c3759b5dca772ff08dee3afa76a): Error starting userland proxy: listen tcp 0.0.0.0:9200: bind: address already in use ERROR: for db Cannot start service db: driver failed programming external connectivity on endpoint pubannotation_db_1 (1ac1d94f2bb6b6916c07908b0650b89686b7a91354bb2834e9e3155644fddf03): Error starting userland proxy: listen tcp 0.0.0.0:5432: bind: address already in use ERROR: for elasticsearch Cannot start service elasticsearch: driver failed programming external connectivity on endpoint pubannotation_elasticsearch_1 (66ba56873f80c2536192a2b9a22829ec83515c3759b5dca772ff08dee3afa76a): Error starting userland proxy: listen tcp 0.0.0.0:9200: bind: address already in use ERROR: Encountered errors while bringing up the project.
あれあれ、起動したかったPostgreSQLもElasticSearchもインストール済みでした。 Docker入れなくてもよかったじゃん!