前提・実現したいこと
ホストOS:Ubuntu 18.10
コンテナ:Ubuntu 18.04.2 LTS
dockerによるサーバ構築をなるべく自分でコードを書いて構築しようとしています。
nginxのPGPキーを追加する際に以下のコマンドで実行しましたが、
ホストOS上では成功するのにコンテナで実行すると失敗します。
発生している問題・エラーメッセージ
bash
1--2019-08-09 21:05:48-- http://nginx.org/keys/nginx_signing.key 2Resolving nginx.org (nginx.org)... 95.211.80.227, 62.210.92.35, 2001:1af8:4060:a004:21::e3 3Connecting to nginx.org (nginx.org)|95.211.80.227|:80... E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation 4connected. 5HTTP request sent, awaiting response... 200 OK 6Length: 1561 (1.5K) [text/plain] 7Saving to: 'STDOUT'
該当のソースコード
bash
1$ docker container run -it ubuntu 2 3# ここからコンテナ内で実行するコマンド 4$ apt update 5$ apt install wget -y 6 7# 上記を実行後以下のコマンドを実行すると失敗する 8$ wget -O https://nginx.org/keys/nginx_signing.keys | apt-key add - 9 10# 実行結果 11--2019-08-09 21:05:48-- http://nginx.org/keys/nginx_signing.key 12Resolving nginx.org (nginx.org)... 95.211.80.227, 62.210.92.35, 2001:1af8:4060:a004:21::e3 13Connecting to nginx.org (nginx.org)|95.211.80.227|:80... E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation 14connected. 15HTTP request sent, awaiting response... 200 OK 16Length: 1561 (1.5K) [text/plain] 17Saving to: 'STDOUT' 18 19- 0%[ ] 0 --.-KB/s in 0s 20 21 22Cannot write to '-' (No such file or directory).
試したこと
wgetのコマンドが問題かと思いcurlでも試してみました。
bash
1$ curl https://nginx.org/keys/nginx_signing.keys | apt-key add - 2 3# 実行結果 4 % Total % Received % Xferd Average Speed Time Time Time Current 5 Dload Upload Total Spent Left Speed 6 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation 7100 4267 100 4267 0 0 3325 0 0:00:01 0:00:01 --:--:-- 3325 8curl: (23) Failed writing body (0 != 4267)

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。