Docker #7:仮想上にインストール可能か?(2)

■サンプルプロジェクトを実行してみる

1) Docker Quickstart Terminal
"git clone https://github.com/dockersamples/node-bulletin-board" を実行
→ エラーになってしまう。
これはどちらかというと git の問題か?
user@DESKTOP-S0KA939 MINGW64 /c/Program Files/Docker Toolbox
$ git clone https://github.com/dockersamples/node-bulletin-board
fatal: could not create work tree dir 'node-bulletin-board': Permission denied

ダウンロードするフォルダを変更することにした。
ホームディレクトリに "sample" フォルダを作成し、そこにダウンロードする。
user@DESKTOP-S0KA939 MINGW64 /c/Program Files/Docker Toolbox
$ cd ~

user@DESKTOP-S0KA939 MINGW64 ~
$ mkdir sample                                                                                                          

user@DESKTOP-S0KA939 MINGW64 ~
$ cd sample

user@DESKTOP-S0KA939 MINGW64 ~/sample
$ git clone https://github.com/dockersamples/node-bulletin-board                                                        Cloning into 'node-bulletin-board'...
remote: Enumerating objects: 124, done.
Receiving objects:  85% (106/124)
Receiving objects: 100% (124/124), 185.01 KiB | 0 bytes/s, done.
Resolving deltas: 100% (54/54), done.
Checking connectivity... done.
→ 成功

2) ビルド
"cd node-bulletin-board/bulletin-board-app"
"docker build --tag bulletinboard:1.0 ." を実行
user@DESKTOP-S0KA939 MINGW64 ~/sample
$ cd node-bulletin-board/bulletin-board-app

user@DESKTOP-S0KA939 MINGW64 ~/sample/node-bulletin-board/bulletin-board-app (master)
$ docker build --tag bulletinboard:1.0 .
Sending build context to Docker daemon  45.57kB
Step 1/7 : FROM node:current-slim
current-slim: Pulling from library/node
7d2977b12acb: Pull complete                                                                                             23e9a36a6e2d: Pull complete                                                                                             831103f0eed4: Pull complete                                                                                             f172d5646bed: Pull complete                                                                                             9f1d0c9b6ec5: Pull complete                                                                                             Digest: sha256:4f837156a4bc43b6c8af7195dd7dbfc0b46e6f3515f777e2cb53139dc4faee33
Status: Downloaded newer image for node:current-slim
 ---> 0e2e78467169
Step 2/7 : WORKDIR /usr/src/app
 ---> Running in 7d1f9feb06ec
Removing intermediate container 7d1f9feb06ec
 ---> 9fd234813d82
Step 3/7 : COPY package.json .
 ---> dae0e8b18c8e
Step 4/7 : RUN npm install
 ---> Running in ffb0d71c37be

> ejs@2.7.4 postinstall /usr/src/app/node_modules/ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN vue-event-bulletin@1.0.0 No repository field.
npm WARN The package morgan is included as both a dev and production dependency.

added 91 packages from 168 contributors and audited 92 packages in 21.23s
found 0 vulnerabilities


Removing intermediate container ffb0d71c37be
 ---> cf16b502eb47
Step 5/7 : EXPOSE 8080
 ---> Running in 1c73e9f6b526
Removing intermediate container 1c73e9f6b526
 ---> 2a493a5d8a48
Step 6/7 : CMD [ "npm", "start" ]
 ---> Running in 7124aec587d9
Removing intermediate container 7124aec587d9
 ---> c4f20714d4b2
Step 7/7 : COPY . .
 ---> 9a6ac0d7f00d
Successfully built 9a6ac0d7f00d
Successfully tagged bulletinboard:1.0
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.

3) 実行
"docker run --publish 8000:8080 --detach --name bb bulletinboard:1.0" を実行
user@DESKTOP-S0KA939 MINGW64 ~/sample/node-bulletin-board/bulletin-board-app (master)
$ docker run --publish 8000:8080 --detach --name bb bulletinboard:1.0
ac9d66b2d8f7f0e5d25a9cafb470c6295c908ac3d61c75e21c01be42e03229fc

"docker-machine ls"コマンドでIPアドレスを確認して
user@DESKTOP-S0KA939 MINGW64 ~/sample/node-bulletin-board/bulletin-board-app (master)
$ docker-machine ls
NAME      ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
default   *        virtualbox   Running   tcp://192.168.99.100:2376           v19.03.5

ブラウザで上記確認したipの8000番ポートへアクセス
"http://192.168.99.100:8000"




Docker, git

0 件のコメント:

その他の記事