「Ubuntu / DebianにコマンドでVSCode (Visual Studio Code) をインストールする方法」がdockerでうまくいっていない記録

Ubuntu / DebianにコマンドでVSCode (Visual Studio Code) をインストールする方法
https://www.karelie.net/ubuntu-debian-command-install-vscode/

 <この項は書きかけです。順次追記します。>

```
# curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   983  100   983    0     0   1633      0 --:--:-- --:--:-- --:--:--  1632
root@60c8ebb17fc3:/# install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/

# sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'

# apt install apt-transport-https
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 171 kB of archives.
After this operation, 243 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian stretch/main amd64 apt-transport-https amd64 1.4.9 [171 kB]
Fetched 171 kB in 0s (237 kB/s)         
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package apt-transport-https.
(Reading database ... 30138 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_1.4.9_amd64.deb ...
Unpacking apt-transport-https (1.4.9) ...
Setting up apt-transport-https (1.4.9) ...

# apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

# apt install code
Reading package lists... Done
Building dependency tree        
Reading state information... Done
E: Unable to locate package code
```
microsoft.gpgというファイルはできている。

```
/# ls -al
total 76
drwxr-xr-x   1 root root 4096 May  4 10:40 .
drwxr-xr-x   1 root root 4096 May  4 10:40 ..
-rwxr-xr-x   1 root root    0 May  4 10:24 .dockerenv
drwxr-xr-x   1 root root 4096 Mar 27 08:27 bin
drwxr-xr-x   2 root root 4096 Feb  3 22:01 boot
drwxr-xr-x   5 root root  360 May  4 10:24 dev
drwxr-xr-x   1 root root 4096 May  4 10:31 etc
drwxr-xr-x   2 root root 4096 Feb  3 22:01 home
drwxr-xr-x   1 root root 4096 Mar 27 08:28 lib
drwxr-xr-x   2 root root 4096 Mar 26 21:00 lib64
drwxr-xr-x   2 root root 4096 Mar 26 21:00 media
-rw-r--r--   1 root root  641 May  4 10:40 microsoft.gpg
drwxr-xr-x   2 root root 4096 Mar 26 21:00 mnt
drwxr-xr-x   2 root root 4096 Mar 26 21:00 opt
dr-xr-xr-x 180 root root    0 May  4 10:24 proc
drwx------   1 root root 4096 Mar 27 15:48 root
drwxr-xr-x   3 root root 4096 Mar 26 21:00 run
drwxr-xr-x   1 root root 4096 Mar 27 08:26 sbin
drwxr-xr-x   2 root root 4096 Mar 26 21:00 srv
dr-xr-xr-x  13 root root    0 May  4 10:24 sys
drwxrwxrwt   1 root root 4096 May  4 10:43 tmp
drwxr-xr-x   1 root root 4096 Mar 26 21:00 usr
drwxr-xr-x   1 root root 4096 Mar 26 21:00 var
```
中身が有効かどうかを確かめる方法未確認。

```
/# ls -al /etc/apt/trusted.gpg.d/
total 60
drwxr-xr-x 1 root root 4096 May  4 10:40 .
drwxr-xr-x 1 root root 4096 Mar 26 21:00 ..
-rw-r--r-- 1 root root 5138 May 26  2017 debian-archive-jessie-automatic.gpg
-rw-r--r-- 1 root root 5147 May 26  2017 debian-archive-jessie-security-automatic.gpg
-rw-r--r-- 1 root root 2775 May 26  2017 debian-archive-jessie-stable.gpg
-rw-r--r-- 1 root root 7483 May 26  2017 debian-archive-stretch-automatic.gpg
-rw-r--r-- 1 root root 7492 May 26  2017 debian-archive-stretch-security-automatic.gpg
-rw-r--r-- 1 root root 2275 May 26  2017 debian-archive-stretch-stable.gpg
-rw-r--r-- 1 root root 3780 May 26  2017 debian-archive-wheezy-automatic.gpg
-rw-r--r-- 1 root root 2851 May 26  2017 debian-archive-wheezy-stable.gpg
-rw-r--r-- 1 root root  641 May  4 10:40 microsoft.gpg
```
 /etc/apt/trusted.gpg.d/にinstallはできている。中身未確認。


https://packages.microsoft.com/repos/vscode 

```
Index of /repos/vscode/

../
dists/                                             15-Feb-2017 23:11                   -
pool/                                              15-Feb-2017 23:11                   -
```

```
Index of /repos/vscode/dists/

../
stable/                                            03-May-2019 07:14                   -
```

distsの下にstableがある。

```
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
```
を

```
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode/dists stable main" > /etc/apt/sources.list.d/vscode.list'
```
に変更して実施してみる。

```
# sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode/dists stable main" > /etc/apt/sources.list.d/vscode.list'
/# apt update
Ign:1 http://deb.debian.org/debian stretch InRelease
Hit:2 http://security.debian.org/debian-security stretch/updates InRelease
Hit:3 http://deb.debian.org/debian stretch-updates InRelease
Hit:4 http://deb.debian.org/debian stretch Release 
Ign:5 https://packages.microsoft.com/repos/vscode/dists stable InRelease
Err:7 https://packages.microsoft.com/repos/vscode/dists stable Release
  404  Not Found
Reading package lists... Done
E: The repository 'https://packages.microsoft.com/repos/vscode/dists stable Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
root@60c8ebb17fc3:/# apt install code
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package code
```

さっきはupdateじゃなくてうupgradeってしてた。
もう一度、初めからやり直す。

 
 ＜この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。＞
### 最後までおよみいただきありがとうございました。

いいね　💚、フォローをお願いします。

####Thank you very much for reading to the last sentence.

Please press the like icon 💚　and follow me for your happy life.