2020年7月20日月曜日

WSL2のUbuntu20で使ってる Emacsの init.el


wsl バージョン確認
PS C:\workspace> wsl -l -v
  NAME            STATE           VERSION
* Ubuntu-18.04    Stopped         1
  Ubuntu-20.04    Running         2

ubuntuバージョン確認
ubuntu@MyComputer:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04 LTS
Release:        20.04
Codename:       focal
ubuntu@MyComputer:~$ emacs --version
GNU Emacs 26.3
Copyright (C) 2019 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

~/.emacs.d/init.el 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 日本語
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(set-language-environment 'Japanese)        ; 日本語環境
(set-default-coding-systems 'utf-8-unix)    ; UTF-8 が基本
(set-terminal-coding-system 'utf-8-unix)    ; emacs -nw も文字化けしない
(setq default-file-name-coding-system 'utf-8)
(setq default-process-coding-system '(utf-8 . utf-8))
(prefer-coding-system 'utf-8-unix)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; パッケージ
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(package-initialize)
(setq package-archives
      '(("gnu" . "http://elpa.gnu.org/packages/")
        ("melpa" . "http://melpa.org/packages/")
        ("melpa stable" . "https://stable.melpa.org/packages/")
        ("org" . "http://orgmode.org/elpa/")))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; GIT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; git
(global-set-key (kbd "M-g") 'magit-status)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; プログラムの書式
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; markdown
(autoload 'markdown-mode "markdown-mode"
   "Major mode for editing Markdown files" t)
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))

(autoload 'gfm-mode "markdown-mode"
   "Major mode for editing GitHub Flavored Markdown files" t)
(add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode))

;; yaml
(require 'yaml-mode)
(add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode))
(require 'yaml-mode)
(add-to-list 'auto-mode-alist '("\\.yaml\\'" . yaml-mode))
;(require 'flymake-yaml)
;(add-hook 'yaml-mode-hook 'flymake-yaml-load)
(require 'highlight-indentation)
(setq highlight-indentation-offset 2)
;(set-face-background 'highlight-indentation-face "#e3e3d3")
;(set-face-background 'highlight-indentation-current-column-face "#c3b3b3")
(set-face-background 'highlight-indentation-face "#555500")
(set-face-background 'highlight-indentation-current-column-face "#00ff00")
(add-hook 'yaml-mode-hook 'highlight-indentation-mode)
(add-hook 'yaml-mode-hook 'highlight-indentation-current-column-mode)
(add-hook 'yaml-mode-hook '(lambda() (setq highlight-indentation-offset 2)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; キーマップ
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Deleteキーでカーソル位置の文字が消えるようにする
(global-set-key [delete] 'delete-char)

;; C-h は Backspace でないと押し間違えてしまうらしい
(define-key global-map "\C-h"      'backward-delete-char)

;; 行番号指定ジャンプ
(define-key global-map "\C-x\C-\j" 'goto-line)

;; C-t でスクロールダウン
(define-key global-map "\C-t" 'scroll-down)

;; コンパイル
(define-key global-map "\C-xc" 'compile)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 見栄え
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; splash screenを無効にする
(setq inhibit-splash-screen t)

;; font
;;(add-to-list 'default-frame-alist '(font . "ricty-12"))

;; line numberの表示
(require 'linum)
(global-linum-mode 1)
(setq linum-format "%4d ")

;; 行番号と列番号を表示する
(column-number-mode t)

;; tabサイズ
(setq default-tab-width 4)
;; インデント無効
(electric-indent-mode -1)

;; メニューバーを非表示
(menu-bar-mode 0)

;; ツールバーを非表示
;;(tool-bar-mode 0)

;; default scroll bar消去
;;(scroll-bar-mode -1)

;; 対応する括弧をハイライト
(show-paren-mode 1)

;;; タイトルバーにファイル名を表示する
(setq frame-title-format (format "emacs@%s : %%f" (system-name)))

;; 現在行をアンダーライン
(if (not window-system) (progn
                                                  (setq hl-line-face 'underline)
                                                  (global-hl-line-mode)
                                                  ))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; いろいろ
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;バッファの最後でnewlineで新規行を追加するのを禁止する
(setq next-line-add-newlines nil)

;; スクロールは1行ごとに
(setq mouse-wheel-scroll-amount '(1 ((shift) . 5)))

;; スクロールの加速をやめる
(setq mouse-wheel-progressive-speed nil)

;; bufferの最後でカーソルを動かそうとしても音をならなくする
(defun next-line (arg)
  (interactive "p")
  (condition-case nil
          (line-move arg)
        (end-of-buffer)))

;; エラー音をならなくする
(setq ring-bell-function 'ignore)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; このファイルに間違いがあった場合に全てを無効にします
(put 'eval-expression 'disabled nil)







2020年7月19日日曜日

楽天モバイル(RUKTEN UN-LIMIT)とBroadWiMAXの速度比較


2020年7月18(土曜日)の15:00 ぐらいに測定してみた
BroadWiMAXはいらないと思った。。。


PCからスマホ(RUKUTEN UN-LIMIT)にWiFiテザリングして計測





PCからBroadWiMAXにWiFi接続して計測






2020年7月18日土曜日

CloudFormationをMakefileで実行する


CloudForamtion のテンプレート検証や、構築作業で使うコマンドをMakefileに定義して実行します。

テンプレート検証は、cfn-lint を使用します。
cfn-lintの詳細は下記URLを参照してください。

Makefileの作成


今回は、Makefile を下記のように記載します。
  • cfn で始まるテンプレート(cfn_*.yml) を検証
  • VPC, ECRを作成するaws-cliコマンドを実行(create-stack, update-stack)
  • Stackのリストを参照
CFNLINTCMD := cfn-lint
CFNCMD  := create-stack
AWSPROFILE := blue21

all: cfnlint
cfnlint:
        $(CFNLINTCMD) cfn_*.yml
clean:
        rm -f README.html *~

# VPC
d00vpc:
        aws cloudformation $(CFNCMD) \
        --profile $(AWSPROFILE) \
        --stack-name Blue21Ops00Vpc00D00 \
        --template-body file://`pwd`/cfn_vpc.yml
# ECR
d00ecr:
        aws cloudformation $(CFNCMD) \
        --profile $(AWSPROFILE) \
        --stack-name Blue21Ops00Ecr00 \
        --template-body file://`pwd`/cfn_ecr.yml
# LIST
cfnlist:
        aws cloudformation describe-stacks \
        --profile $(AWSPROFILE) \
        --query 'Stacks[].{StackName:StackName,StackStatus:StackStatus,Desc:Description}' \
        --output table

cfnテンプレートの検証


下記のようにmakeコマンドを実行すると cfn-lint コマンドが実行されます。
エラーがなければ下記のようにメッセージは表示されません。
$ make
cfn-lint cfn_*.yml
下記は未使用のパラメータ(Dummy)が定義された場合のエラーメッセージです。
エラーのあるテンプレートファイル名、行、カラムが表示されます。
$ make
cfn-lint cfn_*.yml
W2001 Parameter Dummy not used.
cfn_ecr.yml:17:3

make: *** [Makefile:8: cfnlint] Error 4

create-stack/update-stack の実行

Makefileに記載した awscli コマンドを実行して CloudFormationのスタックを作成したり更新することができます。
ECRを create-stackする場合は、下記のようにmakeコマンドを実行します。
$ make d00ecr
ECRを update-stackする場合は、下記のようにmakeコマンドを実行します。
$ make d00ecr CFNCMD=update-stack

stack一覧の参照

CloudFormationのstack一覧を見たいときは、下記のようにmakeコマンドを実行します。
$ make cfnlist
aws cloudformation describe-stacks \
--profile blue21 \
--query 'Stacks[].{StackName:StackName,StackStatus:StackStatus,Desc:Description}' \
--output table
-----------------------------------------------------------------------------
|                              DescribeStacks                               |
+---------------------------+---------------------------+-------------------+
|           Desc            |         StackName         |    StackStatus    |
+---------------------------+---------------------------+-------------------+
|  ECR                      |  Blue21Ops00Ecr00         |  CREATE_COMPLETE  |
|  VPC & subnet             |  Blue21Ops00Vpc00D00      |  UPDATE_COMPLETE  |
+---------------------------+---------------------------+-------------------+

emacs から make コマンドを実行

emacs から make コマンドを実行したい場合は、~/.emacs.d/init.el に下記を記載します。
(define-key global-map "\C-xc" 'compile)
Ctl+x のあと c キーで下記のように make コマンドが表示されるので、このままENTERすると検証コマンド(cfn-lint)が実行されます。

cfn-lint の実行結果は、下記のようにして参照できます。




2020年7月7日火曜日

WSL2にvpn接続してWindowsからDockerコンテナのIPでアクセスしてみた


WSL2で動いてるDockerコンテナに、WindowsからIPアドレス(172.17.0.3など)でアクセスしたい。
ポートを変えて localhost でアクセスするのが嫌だ。
コンテナたくさんあるので。

SoftetherVPN を使ってWindowsからWSL2にVPN接続すれば、WSL2のDockerコンテナにIPアドレスでアクセスできるのでは?

と思って、試してみました。

1. WSL2のDockerコンテナとしてSoftEtherVPNサーバを導入


1.1. コンテナ構築

Dockerfile を下記のように作成

SoftEtherVPNサーバをインストールして、起動します。

FROM centos:7
RUN yum -y install gcc make which net-tools
RUN cd /usr/local && \
    curl -L -o softether-vpnserver.tar.gz https://jp.softether-download.com/files/softether/v4.34-9745-rtm-2020.04.05-tree/Linux/SoftEther_VPN_Server/64bit_-_Intel_x64_or_AMD64/softether-vpnserver-v4.34-9745-rtm-2020.04.05-linux-x64-64bit.tar.gz && \
    tar xvfz softether-vpnserver.tar.gz
WORKDIR /usr/local/vpnserver
RUN make i_read_and_agree_the_license_agreement && \
    chmod 600 * && \
    chmod 700 vpncmd && \
    chmod 700 vpnserver
CMD ["/usr/local/vpnserver/vpnserver", "execsvc"]


Dockerfileと同じディレクトリにdocker-compose.yml を下記のように作成

コンテナは、host ネットワークを使用します。

version: '3'
services:
  server:
    build: .
    network_mode: host


"docker-compose build" でビルドして

"docker-compose up -d" でSoftetherVPNサーバを起動します。


1.2. SoftEtherVPNサーバの設定

"docker-compose exec server bash" を実行してコンテナに入ります。

check します.

[root@MyComputer vpnserver]# ./vpncmd localhost /tools
vpncmd command - SoftEther VPN Command Line Management Utility
SoftEther VPN Command Line Management Utility (vpncmd command)
Version 4.34 Build 9745   (English)
Compiled 2020/04/05 23:39:56 by buildsan at crosswin
Copyright (c) SoftEther VPN Project. All Rights Reserved.

VPN Tools has been launched. By inputting HELP, you can view a list of the commands that can be used.

VPN Tools>check
Check command - Check whether SoftEther VPN Operation is Possible
---------------------------------------------------
SoftEther VPN Operation Environment Check Tool

Copyright (c) SoftEther VPN Project.
All Rights Reserved.

If this operation environment check tool is run on a system and that system passes, it is most likely that SoftEther VPN software can operate on that system. This check may take a while. Please wait...

Checking 'Kernel System'...
              Pass
Checking 'Memory Operation System'...
              Pass
Checking 'ANSI / Unicode string processing system'...
              Pass
Checking 'File system'...
              Pass
Checking 'Thread processing system'...
              Pass
Checking 'Network system'...
              Pass

All checks passed. It is most likely that SoftEther VPN Server / Bridge can operate normally on this system.

The command completed successfully.

VPN Tools>exit
[root@MyComputer vpnserver]#


SoftEtherVPNサーバの設定をします。

[root@MyComputer vpnserver]# ./vpncmd localhost /server
vpncmd command - SoftEther VPN Command Line Management Utility
SoftEther VPN Command Line Management Utility (vpncmd command)
Version 4.34 Build 9745   (English)
Compiled 2020/04/05 23:39:56 by buildsan at crosswin
Copyright (c) SoftEther VPN Project. All Rights Reserved.

Connection has been established with VPN Server "localhost" (port 443).

You have administrator privileges for the entire VPN Server.

VPN Server>

HUBを指定してユーザを作成し、パスワードを設定します。

VPN Server>Hub DEFAULT
Hub command - Select Virtual Hub to Manage
The Virtual Hub "DEFAULT" has been selected.
The command completed successfully.

VPN Server/DEFAULT>UserCreate vpnuser /GROUP:none /REALNAME:none /NOTE:none
UserCreate command - Create User
The command completed successfully.

VPN Server/DEFAULT>UserPasswordSet vpnuser
UserPasswordSet command - Set Password Authentication for User Auth Type and Set Password
Please enter the password. To cancel press the Ctrl+D key.

Password: ********
Confirm input: ********


The command completed successfully.

VPN Server/DEFAULT>


IPSecとSecureNATを有効にします。

"vpnvpn"が、事前共有キーです。

VPN Server/DEFAULT>IPsecEnable
IPsecEnable command - Enable or Disable IPsec VPN Server Function
Enable L2TP over IPsec Server Function (yes / no): yes

Enable Raw L2TP Server Function (yes / no): no

Enable EtherIP / L2TPv3 over IPsec Server Function (yes / no): no

Pre Shared Key for IPsec (Recommended: 9 letters at maximum): vpnvpn

Default Virtual HUB in a case of omitting the HUB on the Username: DEFAULT

The command completed successfully.

VPN Server/DEFAULT>SecureNatEnable
SecureNatEnable command - Enable the Virtual NAT and DHCP Server Function (SecureNat Function)
The command completed successfully.

VPN Server/DEFAULT>


コンテナからでたあと、下記コマンドで上記設定を保存します。

$ docker-compose exec server cat ./vpn_server.config > ./vpn_server.config

Dockerfile を修正して、保存した設定を使用するようにします。

下から2行目のCOPYを追加しました。

FROM centos:7
RUN yum -y install gcc make which net-tools
RUN cd /usr/local && \
    curl -L -o softether-vpnserver.tar.gz https://jp.softether-download.com/files/softether/v4.34-9745-rtm-2020.04.05-tree/Linux/SoftEther_VPN_Server/64bit_-_Intel_x64_or_AMD64/softether-vpnserver-v4.34-9745-rtm-2020.04.05-linux-x64-64bit.tar.gz && \
    tar xvfz softether-vpnserver.tar.gz
WORKDIR /usr/local/vpnserver
RUN make i_read_and_agree_the_license_agreement && \
    chmod 600 * && \
    chmod 700 vpncmd && \
    chmod 700 vpnserver
COPY vpn_server.config .
CMD ["/usr/local/vpnserver/vpnserver", "execsvc"]

docker-compose build でビルドして、down/up します。


2.Windows10のVPNクライアント設定

事前にWSL2のIPアドレスをしらべておきます。

ubuntu@MyComputer:~$ ip a show dev eth0
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:15:5d:7c:48:74 brd ff:ff:ff:ff:ff:ff
    inet 192.168.158.243/20 brd 192.168.159.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::215:5dff:fe7c:4874/64 scope link
       valid_lft forever preferred_lft forever


2.1.Windows標準のVPNクライアントの作成


Windows標準のVPNクライアントを使用します。


下図だとサーバ名をlocalhostにしてますが、 つながらないので、WSL2のIPアドレスを指定します。




2.2. アダプターの設定変更

※これは必須ではないかも。

上記2.1で作成したVPNクライアントのアダプター設定を変更します。


「セキュリティ」タブで下図のプロトコルを許可します。

「ネットワーク」タブで、ipv6を無効にして、ipv4のプロパティを開きます。


DNSサーバを設定します。8.8.8.8はGoogleのDNSサーバです。
詳細設定をクリック


"リモートネットワークでデフォルトゲートウェイを使用"のチェックを外します。


2.3.ルーティングテーブルの設定


windowsのルーティングテーブルを変更します。
まず、VPNのIFを調べます。
下記の例だと 63 です。
PS C:\workspace> route print -4
===========================================================================
インターフェイス一覧
  7...80 fa 5b 66 ef 15 ......Realtek PCIe GbE Family Controller
 58...00 15 5d 5a e5 2e ......Hyper-V Virtual Ethernet Adapter
 11...0a 00 27 00 00 0b ......VirtualBox Host-Only Ethernet Adapter
  5...0a 00 27 00 00 05 ......VirtualBox Host-Only Ethernet Adapter #2
 63...........................wsl2
 10...d0 c6 37 09 a7 23 ......Microsoft Wi-Fi Direct Virtual Adapter
 13...d2 c6 37 09 a7 22 ......Microsoft Wi-Fi Direct Virtual Adapter #2
  9...d0 c6 37 09 a7 22 ......Intel(R) Wireless-AC 9462
  1...........................Software Loopback Interface 1
===========================================================================

今回はWSL2のDockerコンテナが使用しているIPが172.19で始まるIPなので、
172.19で始まるIPアドレスは、上記で調べたVPNのIFを使うように設定を追加します。
下記のようにコマンドを実行します。
route add 172.19.0.0 mask 255.255.0.0 192.168.30.1 if 63
これは、一時的な変更なので、VPNの接続を切ると、消えます。

3. 動作確認


WSL2 でコンテナのIPを調べます
docker ps でコンテナIDを確認して、
docker inspect <コンテナID>を実行すると、下図のようにIPアドレスを確認できます。

Windowsのターミナルから、調べたコンテナのIP(172.19.0.2)にPINGして下図のように疎通したらOKです。





2020年7月6日月曜日

WSL2のubuntu20.04でdockerを動かす


windows10のwsl2 に docker環境を作ったときのメモ
wsl2 のOSは下記のとおり
ubuntu@MyComputer:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04 LTS
Release:        20.04
Codename:       focal

下記URLを参照してdockerをインストールしました。

dockerを使おうとしたら、下記のようなエラーがでたので
docker: Error response from daemon: cgroups: cannot find cgroup mount destination: unknown.

いろいろ調べていたら、下記のページを見つけた。

見つけたページを参考にして、wsl2のubuntu にdaemonize パッケージをいれて
sudo apt install daemonize

下記のシェルを実行すると、systemctl が使用できるようになった。
ubuntu@MyComputer:~/docker/vpn$ cat ~/start_systemd.sh
# https://qiita.com/matarillo/items/f036a9561a4839275e5f
#

#
SYSTEMD_PID="$(ps -ef | grep '/lib/systemd/systemd --system-unit=basic.target$' | grep -v unshare | awk '{print $2}')"
if [ -z "$SYSTEMD_PID" ]; then
  sudo daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target
  sleep 1
fi

#
exec sudo nsenter --target $(pidof systemd) --all su - $LOGNAME

上記のシェル(start_systemd.sh)を実行する前のプロセスは下記のとおり。
ubuntu@MyComputer:~$ ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 09:56 ?        00:00:00 /init
root         6     1  0 09:56 ?        00:00:00 /init
root         7     6  0 09:56 ?        00:00:00 /init
ubuntu       8     7  0 09:56 pts/0    00:00:00 -bash

上記のシェル(start_systemd.sh)を実行した後のプロセスは下記のとおり。
ubuntu@MyComputer:~$ ps -ef
UID          PID    PPID  C STIME TTY          TIME CMD
root           1       0  0 10:06 ?        00:00:00 /lib/systemd/systemd --system-unit=basic.target
root          42       1  0 10:06 ?        00:00:00 /lib/systemd/systemd-journald
root          63       1  0 10:06 ?        00:00:00 /lib/systemd/systemd-udevd
systemd+      67       1  0 10:06 ?        00:00:00 /lib/systemd/systemd-networkd
root         219       0  0 10:06 pts/0    00:00:00 su - ubuntu
ubuntu       220     219  0 10:06 pts/0    00:00:00 -bash
systemd+     239       1  0 10:06 ?        00:00:00 /lib/systemd/systemd-resolved
systemd+     240       1  0 10:06 ?        00:00:00 /lib/systemd/systemd-timesyncd
root         245       1  0 10:06 ?        00:00:00 /usr/lib/accountsservice/accounts-daemon
message+     246       1  0 10:06 ?        00:00:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfil
root         252       1  0 10:06 ?        00:00:00 /usr/sbin/irqbalance --foreground
root         253       1  0 10:06 ?        00:00:00 /usr/bin/python3 /usr/bin/networkd-dispatcher --run-startup-triggers
syslog       255       1  0 10:06 ?        00:00:00 /usr/sbin/rsyslogd -n -iNONE
root         256       1  1 10:06 ?        00:00:01 /usr/lib/snapd/snapd
root         260       1  0 10:06 ?        00:00:00 /lib/systemd/systemd-logind
root         267       1  0 10:06 ?        00:00:00 /usr/sbin/cron -f
root         281       1  0 10:06 ?        00:00:00 /usr/bin/containerd
daemon       282       1  0 10:06 ?        00:00:00 /usr/sbin/atd -f
root         283       1  0 10:06 ?        00:00:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.so
root         293       1  0 10:06 tty1     00:00:00 /sbin/agetty -o -p -- \u --noclear tty1 linux
root         307       1  0 10:06 ?        00:00:00 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
root         319       1  0 10:06 ?        00:00:00 /usr/lib/policykit-1/polkitd --no-debug
root         320       1  0 10:06 ?        00:00:00 /usr/bin/python3 /usr/share/unattended-upgrades/unattended-upgrade-s
ubuntu       583     220  0 10:08 pts/0    00:00:00 ps -ef

これで、docker は使えるようになったが
DNSの名前解決ができなくなったので、/etc/systemd/resolved.conf を修正
[Resolve]
DNS=8.8.8.8
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#DNSOverTLS=no
#Cache=yes
#DNSStubListener=yes
#ReadEtcHosts=yes

下記のコマンドで変更を反映したら、DNSの名前解決できるようになった。
systemctl restart systemd.resolved