· 6 years ago · May 06, 2019, 06:32 AM
1To run a command as administrator (user "root"), use "sudo <command>".
2See "man sudo_root" for details.
3
4demouser@LABVM-30291:~$ pwd
5/home/demouser
6demouser@LABVM-30291:~$ wget https://opsgilitylabs.blob.core.windows.net/online-labs/introduction-to-azure-container-instances/StudentFiles.zip
7--2019-05-06 04:34:19-- https://opsgilitylabs.blob.core.windows.net/online-labs/introduction-to-azure-container-instances/StudentFiles.zip
8Resolving opsgilitylabs.blob.core.windows.net (opsgilitylabs.blob.core.windows.net)... 52.241.88.36
9Connecting to opsgilitylabs.blob.core.windows.net (opsgilitylabs.blob.core.windows.net)|52.241.88.36|:443... connected.
10HTTP request sent, awaiting response... 200 OK
11Length: 4323 (4.2K) [application/x-zip-compressed]
12Saving to: ‘StudentFiles.zip’
13
14StudentFiles.zip 100%[===================>] 4.22K --.-KB/s in 0s
15
162019-05-06 04:34:20 (625 MB/s) - ‘StudentFiles.zip’ saved [4323/4323]
17
18demouser@LABVM-30291:~$ unzip StudentFiles.zip -d /home/demouser
19Archive: StudentFiles.zip
20 creating: /home/demouser/StudentFiles/aci-helloworld-master/
21 inflating: /home/demouser/StudentFiles/aci-helloworld-master/.gitignore
22 creating: /home/demouser/StudentFiles/aci-helloworld-master/app/
23 inflating: /home/demouser/StudentFiles/aci-helloworld-master/app/index.html
24 inflating: /home/demouser/StudentFiles/aci-helloworld-master/app/index.js
25 inflating: /home/demouser/StudentFiles/aci-helloworld-master/app/package.json
26 inflating: /home/demouser/StudentFiles/aci-helloworld-master/Dockerfile
27 inflating: /home/demouser/StudentFiles/aci-helloworld-master/LICENSE
28 inflating: /home/demouser/StudentFiles/aci-helloworld-master/README.md
29demouser@LABVM-30291:~$ ls
30Desktop Downloads Pictures StudentFiles Templates thinclient_drives
31Documents Music Public StudentFiles.zip Videos
32demouser@LABVM-30291:~$ pwd
33/home/demouser
34demouser@LABVM-30291:~$ pwd
35/home/demouser
36demouser@LABVM-30291:~$ ls
37Desktop Downloads Pictures StudentFiles Templates thinclient_drives
38Documents Music Public StudentFiles.zip Videos
39demouser@LABVM-30291:~$ ls -l
40total 44
41drwxrwxr-x 2 demouser demouser 4096 May 6 04:29 Desktop
42drwxr-xr-x 2 demouser demouser 4096 May 6 04:29 Documents
43drwxr-xr-x 2 demouser demouser 4096 May 6 04:29 Downloads
44drwxr-xr-x 2 demouser demouser 4096 May 6 04:29 Music
45drwxr-xr-x 2 demouser demouser 4096 May 6 04:29 Pictures
46drwxr-xr-x 2 demouser demouser 4096 May 6 04:29 Public
47drwxrwxr-x 3 demouser demouser 4096 May 6 04:35 StudentFiles
48-rw-rw-r-- 1 demouser demouser 4323 Feb 15 21:11 StudentFiles.zip
49drwxr-xr-x 2 demouser demouser 4096 May 6 04:29 Templates
50drwxr-xr-x 2 demouser demouser 4096 May 6 04:29 Videos
51drwxr-xr-x 0 root root 0 Jan 1 1970 thinclient_drives
52demouser@LABVM-30291:~$ sudo snap install docker
532019-05-06T04:37:15Z INFO Waiting for restart...
54docker 18.06.1-ce from Canonical✓ installed
55demouser@LABVM-30291:~$ cd StudentFiles/aci-helloworld-master/
56demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ ls
57Dockerfile LICENSE README.md app
58demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ cat Dockerfile
59FROM node:8.9.3-alpine
60RUN mkdir -p /usr/src/app
61COPY ./app/ /usr/src/app/
62WORKDIR /usr/src/app
63RUN npm install
64CMD node /usr/src/app/index.jsdemouser@LABVM-30291:~/StudentFiles/aci-helloworld-mast-helloworld-master
65Sending build context to Docker daemon 12.8kB
66Step 1/6 : FROM node:8.9.3-alpine
678.9.3-alpine: Pulling from library/node
681160f4abea84: Pull complete
6966ff3f133e43: Pull complete
704c8ff6f0a4db: Pull complete
71Digest: sha256:40201c973cf40708f06205b22067f952dd46a29cecb7a74b873ce303ad0d11a5
72Status: Downloaded newer image for node:8.9.3-alpine
73 ---> 144aaf4b1367
74Step 2/6 : RUN mkdir -p /usr/src/app
75 ---> Running in 18929c43d4a1
76Removing intermediate container 18929c43d4a1
77 ---> ea8ef127e0af
78Step 3/6 : COPY ./app/ /usr/src/app/
79 ---> b8fda3fa5492
80Step 4/6 : WORKDIR /usr/src/app
81 ---> Running in d43ba0691b08
82Removing intermediate container d43ba0691b08
83 ---> a4ebb3341586
84Step 5/6 : RUN npm install
85 ---> Running in 8d1d600ba05a
86npm notice created a lockfile as package-lock.json. You should commit this file.
87npm WARN aci-helloworld@1.0.0 No description
88npm WARN aci-helloworld@1.0.0 No repository field.
89npm WARN aci-helloworld@1.0.0 No license field.
90
91added 51 packages in 1.9s
92Removing intermediate container 8d1d600ba05a
93 ---> c8ae8f90b441
94Step 6/6 : CMD node /usr/src/app/index.js
95 ---> Running in 31c525cb23d1
96Removing intermediate container 31c525cb23d1
97 ---> 698d880daac6
98Successfully built 698d880daac6
99Successfully tagged aci-helloworld-master:latest
100demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ sudo docker images
101REPOSITORY TAG IMAGE ID CREATED SIZE
102aci-helloworld-master latest 698d880daac6 22 seconds ago 70.9MB
103node 8.9.3-alpine 144aaf4b1367 17 months ago 67.7MB
104demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ sudo docker run -d -p 8080:80 aci-helloworld-master
10594692c542042458e4ddc0ef61b4e970bf7f652e08c96c776628e5f257461e783
106demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az login
107Note, we have launched a browser for you to login. For old experience with device code, use "az login --use-device-code"
108Opening in existing browser session.
109You have logged in. Now let us find all the subscriptions to which you have access...
110[
111 {
112 "cloudName": "AzureCloud",
113 "id": "353957de-d3c3-4218-9227-a79dc07e3e99",
114 "isDefault": true,
115 "name": "OTA-PRD-296",
116 "state": "Enabled",
117 "tenantId": "c508a910-5048-4b7b-80a3-713a355929c3",
118 "user": {
119 "name": "user_Kf5F5@OTAPRD296ops.onmicrosoft.com",
120 "type": "user"
121 }
122 }
123]
124demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az group create --name alexander.limRG --location eastasia
125{
126 "id": "/subscriptions/353957de-d3c3-4218-9227-a79dc07e3e99/resourceGroups/alexander.limRG",
127 "location": "eastasia",
128 "managedBy": null,
129 "name": "alexander.limRG",
130 "properties": {
131 "provisioningState": "Succeeded"
132 },
133 "tags": null
134}
135demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ arcName=<arcName>
136bash: syntax error near unexpected token `newline'
137demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az acr create --resource-group alexander.limRG --name alexander.limACR --sku Basic --admin-enabled true
138Parameter 'registry_name' must conform to the following pattern: '^[a-zA-Z0-9]*$'.
139Traceback (most recent call last):
140 File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 206, in invoke
141 cmd_result = self.invocation.execute(args)
142 File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in execute
143 raise ex
144 File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 386, in _run_jobs_serially
145 results.append(self._run_job(expanded_arg, cmd_copy))
146 File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 379, in _run_job
147 six.reraise(*sys.exc_info())
148 File "/opt/az/lib/python3.6/site-packages/six.py", line 693, in reraise
149 raise value
150 File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 356, in _run_job
151 result = cmd_copy(params)
152 File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 171, in __call__
153 return self.handler(*args, **kwargs)
154 File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 441, in default_command_handler
155 return op(**command_args)
156 File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/acr/custom.py", line 103, in acr_create
157 return client.create(resource_group_name, registry_name, registry)
158 File "/opt/az/lib/python3.6/site-packages/azure/mgmt/containerregistry/v2018_09_01/operations/registries_operations.py", line 351, in create
159 **operation_config
160 File "/opt/az/lib/python3.6/site-packages/azure/mgmt/containerregistry/v2018_09_01/operations/registries_operations.py", line 276, in _create_initial
161 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$')
162 File "/opt/az/lib/python3.6/site-packages/msrest/serialization.py", line 592, in url
163 data = self.validate(data, name, required=True, **kwargs)
164 File "/opt/az/lib/python3.6/site-packages/msrest/serialization.py", line 672, in validate
165 raise ValidationError(key, name, value)
166msrest.exceptions.ValidationError: Parameter 'registry_name' must conform to the following pattern: '^[a-zA-Z0-9]*$'.
167demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az acr create --resource-group alexander.limRG --name alexanderlimACR --sku Basic --admin-enabled true
168{
169 "adminUserEnabled": true,
170 "creationDate": "2019-05-06T04:45:18.814082+00:00",
171 "id": "/subscriptions/353957de-d3c3-4218-9227-a79dc07e3e99/resourceGroups/alexander.limRG/providers/Microsoft.ContainerRegistry/registries/alexanderlimACR",
172 "location": "eastasia",
173 "loginServer": "alexanderlimacr.azurecr.io",
174 "name": "alexanderlimACR",
175 "networkRuleSet": null,
176 "provisioningState": "Succeeded",
177 "resourceGroup": "alexander.limRG",
178 "sku": {
179 "name": "Basic",
180 "tier": "Basic"
181 },
182 "status": null,
183 "storageAccount": null,
184 "tags": {},
185 "type": "Microsoft.ContainerRegistry/registries"
186}
187demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ sudo az acr login --name alexanderlimACR
188Login Succeeded
189WARNING! Your password will be stored unencrypted in /root/snap/docker/372/.docker/config.json.
190Configure a credential helper to remove this warning. See
191https://docs.docker.com/engine/reference/commandline/login/#credentials-store
192
193demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ sudo docker images
194REPOSITORY TAG IMAGE ID CREATED SIZE
195aci-helloworld-master latest 698d880daac6 13 minutes ago 70.9MB
196node 8.9.3-alpine 144aaf4b1367 17 months ago 67.7MB
197demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az acr show
198az acr show: error: the following arguments are required: --name/-n
199usage: az acr show [-h] [--verbose] [--debug]
200 [--output {json,jsonc,table,tsv,yaml,none}]
201 [--query JMESPATH] --name REGISTRY_NAME
202 [--resource-group RESOURCE_GROUP_NAME]
203 [--subscription _SUBSCRIPTION]
204demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az acr show --name alexanderlimACR --query loginServer --output table
205Result
206--------------------------
207alexanderlimacr.azurecr.io
208demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ sudo docker tag ^C
209demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ sudo docker tag aci-helloworld-master alexanderlimACR.azurecr.io/aci-helloworld-master:v1
210demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ sudo docker images
211REPOSITORY TAG IMAGE ID CREATED SIZE
212alexanderlimACR.azurecr.io/aci-helloworld-master v1 698d880daac6 15 minutes ago 70.9MB
213aci-helloworld-master latest 698d880daac6 15 minutes ago 70.9MB
214node 8.9.3-alpine 144aaf4b1367 17 months ago 67.7MB
215demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ sudo docker push alexanderlimACR.azurecr.io/aci-helloworld-master:v1
216The push refers to repository [alexanderlimACR.azurecr.io/aci-helloworld-master]
2174cff6cc36d1e: Preparing
218fa15a7d05909: Preparing
2190480c0eb1f08: Preparing
2201dfbdf308b77: Preparing
2212ec940494cc0: Preparing
2226dfaec39e726: Waiting
223unauthorized: authentication required
224demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ sudo docker push alexanderlimacr.azurecr.io/aci-helloworld-master:v1
225The push refers to repository [alexanderlimacr.azurecr.io/aci-helloworld-master]
226An image does not exist locally with the tag: alexanderlimacr.azurecr.io/aci-helloworld-master
227demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ sudo docker tag aci-helloworld-master alexanderlimacr.azurecr.io/aci-helloworld-master:v1
228demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ sudo docker push alexanderlimacr.azurecr.io/aci-helloworld-master:v1
229The push refers to repository [alexanderlimacr.azurecr.io/aci-helloworld-master]
2304cff6cc36d1e: Pushed
231fa15a7d05909: Pushed
2320480c0eb1f08: Pushed
2331dfbdf308b77: Pushed
2342ec940494cc0: Pushed
2356dfaec39e726: Pushed
236v1: digest: sha256:0fa9c7a09020713dbda36c2b80ed7245e1a7f4541f50d7534a5f42f5636aa937 size: 1577
237demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az acr repository list --name alexander.limACXR --output table
238Could not connect to the registry 'alexander.limacxr.azurecr.io'. Please verify if the registry exists.
239demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az acr repository list --name alexander.limACR --output table
240Could not connect to the registry 'alexander.limacr.azurecr.io'. Please verify if the registry exists.
241demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az acr repository list --name alexander.limAacr --output table
242Could not connect to the registry 'alexander.limaacr.azurecr.io'. Please verify if the registry exists.
243demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az acr repository list --name alexander.limacr --output table
244Could not connect to the registry 'alexander.limacr.azurecr.io'. Please verify if the registry exists.
245demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az acr repository list --name alexanderlimacr.azurecr.io --output table
246Could not connect to the registry 'alexanderlimacr.azurecr.io.azurecr.io'. Please verify if the registry exists.
247demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az acr repository list --name alexanderlimacr --output table
248Result
249---------------------
250aci-helloworld-master
251demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az acr repository list --name alexanderlimaACR --output table
252Could not connect to the registry 'alexanderlimaacr.azurecr.io'. Please verify if the registry exists.
253demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az acr repository show-tags --name $arcName --repository aci-helloworld-master --output table
254az acr repository show-tags: error: argument --name/-n: expected one argument
255usage: az acr repository show-tags [-h] [--verbose] [--debug]
256 [--output {json,jsonc,table,tsv,yaml,none}]
257 [--query JMESPATH] --name REGISTRY_NAME
258 --repository REPOSITORY [--top TOP]
259 [--orderby {time_asc,time_desc}]
260 [--resource-group RESOURCE_GROUP_NAME]
261 [--username USERNAME] [--password PASSWORD]
262 [--detail] [--subscription _SUBSCRIPTION]
263demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ arcName=alexanderlimacr
264demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az acr repository show-tags --name $arcName --repository aci-helloworld-master --output table
265Result
266--------
267v1
268demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az acr show --name $arcName --query loginServer
269"alexanderlimacr.azurecr.io"
270demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az acr credential show --name $arczName --query "password[0].value"
271az acr credential show: error: argument --name/-n: expected one argument
272usage: az acr credential show [-h] [--verbose] [--debug]
273 [--output {json,jsonc,table,tsv,yaml,none}]
274 [--query JMESPATH] --name REGISTRY_NAME
275 [--resource-group RESOURCE_GROUP_NAME]
276 [--subscription _SUBSCRIPTION]
277demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az acr credential show --name $arcName --query "password[0].value"
278demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az acr credential show --name $arcName --query "passwords[0].value"
279"SRQvkCWESkQXa2HfKU9uJa3bYjrtNSS/"
280demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az container create --resource-group myResourceGroup --name aci-helloworld-master --image $arcName.azurecr.io/aci-helloworld-master:v1 --cpu 1 --memory 1 --registry-username $arcName --registry-password SRQvkCWESkQXa2HfKU9uJa3bYjrtNSS/ --dns-name-label alexanderlimishere --ports 80
281error retrieving default location: Resource group 'myResourceGroup' could not be found.
282demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az container create --resource-group alexander.limRG --name aci-helloworld-master --image $arcName.azurecr.io/aci-helloworld-master:v1 --cpu 1 --memory 1 --registry-username $arcName --registry-password SRQvkCWESkQXa2HfKU9uJa3bYjrtNSS/ --dns-name-label alexanderlimishere --ports 80
283{
284 "containers": [
285 {
286 "command": null,
287 "environmentVariables": [],
288 "image": "alexanderlimacr.azurecr.io/aci-helloworld-master:v1",
289 "instanceView": {
290 "currentState": {
291 "detailStatus": "",
292 "exitCode": null,
293 "finishTime": null,
294 "startTime": "2019-05-06T06:18:13+00:00",
295 "state": "Running"
296 },
297 "events": [
298 {
299 "count": 1,
300 "firstTimestamp": "2019-05-06T06:18:04+00:00",
301 "lastTimestamp": "2019-05-06T06:18:04+00:00",
302 "message": "pulling image \"alexanderlimacr.azurecr.io/aci-helloworld-master:v1\"",
303 "name": "Pulling",
304 "type": "Normal"
305 },
306 {
307 "count": 1,
308 "firstTimestamp": "2019-05-06T06:18:10+00:00",
309 "lastTimestamp": "2019-05-06T06:18:10+00:00",
310 "message": "Successfully pulled image \"alexanderlimacr.azurecr.io/aci-helloworld-master:v1\"",
311 "name": "Pulled",
312 "type": "Normal"
313 },
314 {
315 "count": 1,
316 "firstTimestamp": "2019-05-06T06:18:13+00:00",
317 "lastTimestamp": "2019-05-06T06:18:13+00:00",
318 "message": "Created container",
319 "name": "Created",
320 "type": "Normal"
321 },
322 {
323 "count": 1,
324 "firstTimestamp": "2019-05-06T06:18:13+00:00",
325 "lastTimestamp": "2019-05-06T06:18:13+00:00",
326 "message": "Started container",
327 "name": "Started",
328 "type": "Normal"
329 }
330 ],
331 "previousState": null,
332 "restartCount": 0
333 },
334 "livenessProbe": null,
335 "name": "aci-helloworld-master",
336 "ports": [
337 {
338 "port": 80,
339 "protocol": "TCP"
340 }
341 ],
342 "readinessProbe": null,
343 "resources": {
344 "limits": null,
345 "requests": {
346 "cpu": 1.0,
347 "memoryInGb": 1.0
348 }
349 },
350 "volumeMounts": null
351 }
352 ],
353 "diagnostics": null,
354 "id": "/subscriptions/353957de-d3c3-4218-9227-a79dc07e3e99/resourceGroups/alexander.limRG/providers/Microsoft.ContainerInstance/containerGroups/aci-helloworld-master",
355 "identity": null,
356 "imageRegistryCredentials": [
357 {
358 "password": null,
359 "server": "alexanderlimacr.azurecr.io",
360 "username": "alexanderlimacr"
361 }
362 ],
363 "instanceView": {
364 "events": [],
365 "state": "Running"
366 },
367 "ipAddress": {
368 "dnsNameLabel": "alexanderlimishere",
369 "fqdn": "alexanderlimishere.eastasia.azurecontainer.io",
370 "ip": "40.81.28.118",
371 "ports": [
372 {
373 "port": 80,
374 "protocol": "TCP"
375 }
376 ],
377 "type": "Public"
378 },
379 "location": "eastasia",
380 "name": "aci-helloworld-master",
381 "networkProfile": null,
382 "osType": "Linux",
383 "provisioningState": "Succeeded",
384 "resourceGroup": "alexander.limRG",
385 "restartPolicy": "Always",
386 "tags": {},
387 "type": "Microsoft.ContainerInstance/containerGroups",
388 "volumes": null
389}
390demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az container show --resource-group alexander.limRG --name aci-helloworld-master --query instanceView.state
391"Running"
392demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az container logs --resource-group alexander.limRG --name aci-helloworld-master
393listening on port 80
394::ffff:10.240.255.55 - - [06/May/2019:06:20:15 +0000] "GET / HTTP/1.1" 200 1663 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36"
395::ffff:10.240.255.55 - - [06/May/2019:06:20:15 +0000] "GET /favicon.ico HTTP/1.1" 404 150 "http://alexanderlimishere.eastasia.azurecontainer.io/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36"
396
397demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$ az group delete --name alexander.limRG
398Are you sure you want to perform this operation? (y/n): y
399demouser@LABVM-30291:~/StudentFiles/aci-helloworld-master$