LoginSignup
0
0

More than 3 years have passed since last update.

cygwin で docker のコンテナ内シェルを使う [docker exec -it bash]

Last updated at Posted at 2020-09-10

cygwin で docker のコンテナ内シェルを使う

環境

  • windows10
  • cygwin
  • Docker Desktop CE for Windows

概要

そのままでは動かなかったので忘備録として残すことに。

  • 以下のように apt-cyg でエラーが出る場合は更新する
$ apt-cyg install gcc-g++
Cache directory is /packages
Mirror is http://mirrors.kernel.org/sourceware/cygwin
--2020-09-10 17:31:34--  https://cygwin.com/key/pubring.asc
cygwin.com (cygwin.com) をDNSに問いあわせています... 8.43.85.97
cygwin.com (cygwin.com)|8.43.85.97|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 3049 (3.0K) [text/plain]
`/tmp/tmp.2B5Pa48nYk' に保存中

/tmp/tmp.2B5Pa48nYk                               100%[=============================================================================================================>]   2.98K  --.-KB/s 時間 0s

2020-09-10 17:31:35 (12.5 MB/s) - `/tmp/tmp.2B5Pa48nYk' へ保存完了 [3049/3049]

TRUSTEDKEY_CYGWIN: FAILED: Hash does not match https://cygwin.com/key/pubring.asc.
Error: TRUSTEDKEY_CYGWIN has been updated, maybe. But sometimes it may has been cracked. Be careful !!!
at : /usr/local/bin/apt-cyg: fetch_trustedkeys: 745

  • winpty が入っていない場合は winpty のインストールをする
$ docker exec -it busy_williamson bash
the input device is not a TTY.  If you are using mintty, try prefixing the command with 'winpty'

apt-cyg の更新

  • apt-cyg を download
$ cd /usr/local/bin
$ wget https://raw.githubusercontent.com/kou1okada/apt-cyg/master/apt-cyg
--2020-09-10 17:39:36--  https://raw.githubusercontent.com/kou1okada/apt-cyg/master/apt-cyg
raw.githubusercontent.com (raw.githubusercontent.com) をDNSに問いあわせています... 151.101.108.133
raw.githubusercontent.com (raw.githubusercontent.com)|151.101.108.133|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 68542 (67K) [text/plain]
`apt-cyg.1' に保存中

apt-cyg.1                                         100%[=============================================================================================================>]  66.94K  --.-KB/s 時間 0.03s

2020-09-10 17:39:48 (2.40 MB/s) - `apt-cyg.1' へ保存完了 [68542/68542]
  • apt-cyg の入れ替え
rm apt-cyg
mv apt-cyg.1 apt-cyg
chmod +x apt-cyg

winpty のインストール

  • gcc-g++, mingw64-x86_64-gcc-g++ のインストール
$ apt-cyg install gcc-g++
$ apt-cyg install mingw64-x86_64-gcc-g++
  • winpty のインストール
$ mkdir winpty (ダウンロードするディレクトリ、適宜用意してください)
$ cd winpty

$ wget https://github.com/rprichard/winpty/archive/master.zip
$ unzip master.zip

$ cd winpty-master/
$ ./configure
$ make
$ make install

docker exec -it bash

  • コンテナコンソール利用
winpty docker exec -it busy_williamson bash

以上、お疲れさまでした!

0
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
0
0