Software Design 2019/11

6月 17, 2023

雑誌 Software Desing 2019年11月号の特集「Microsoft Azure で最新Webアプリ開発」を施行した際の覚書です。自分が、躓いた部分を記載しています。


目次

Microsoft AzureをCLIで使いこなそう!

Webアプリを開発しAzureにデプロイする

Command failed: docker build

WindowsのDocker Desktopで、エラーが発生した場合、dockerのプラットフォームがLinuxになっているか確認しましょう。Windowsの場合は、Docker アイコンを右クリックし、
Switch to Linux container… を選択します。

error: npm install

下記エラーを解決できていません。コンテナ内での実行に問題があるようです。

⇒WSL2上で動作するdocker desktopで試したところ、Windowsでも問題なく動作しました。(2020/7/23)

おそらく、下記で指摘されている問題と同様であり、Windows用dockerの問題のようです。

https://github.com/docker/compose/issues/7466

docker desktopのバージョンは、2.3.0.3 (45519) です。(2020/7/22)

当面待つか、MacやLinuxで実施する必要がありそうです。この記事では、WSL2でdockerを使う記事もありますので、そちらで試してみます。

Forward Port

記事では、[Remote-Containers: Forward Port from Container…]で、ローカルPCのportをコンテナ内のportにつなぐとありますが、私の環境(VSCode 1.47.2, Remote Development 0.20.0)では、メニュが出ませんでした。代わりに [Remote Explorer: Focus On Containers View] で、コンテナの情報を表示させ、Forwardできました。

error: az webapp up

記事の通りのazコマンドを入力すると、すでに"linux plan"というリソースがあるとエラーになりました。ただし、"linux plan"を削除してもう一度実行すると、アップロードできました。

Azure Web AppsでWebアプリの運用・監視体験

WSL2で変わるWindowsでの開発

Azure CLIのインストール

Azure CLIのインストールエラー

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

WSL2にすれば、エラーはでませんでした。

Fetched 5277 kB in 14s (368 kB/s)
Reading package lists... Done
apt-get install -y apt-transport-https lsb-release gnupg curl
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
sudo dpkg --configure -a
error: docker-compose

xxxxx@Win10-6700K:~$ docker-compose up -d

The command 'docker-compose' could not be found in this WSL 2 distro.
We recommend to activate the WSL integration in Docker Desktop settings.

See https://docs.docker.com/docker-for-windows/wsl/ for details.

カレントに Dockerfile がなかっただけでした…

php debug

コンテナとWSLのデバッグするファイルマッピングは、記事とは異なり、下記のように設定しました。

右側のローカルは、記事とは違って htmlを加えています。たぶん、記事が間違っている。

            "pathMappings": {"/var/www/html": "${workspaceRoot}/html"}

プログラム開発

Posted by iwadjp