我在Docker容器中执行了一项服务,并将容器端口Launching lib\main.dart on AOSP on IA Emulator in debug mode...
lib/services/database.dart:68:49: Error: The argument type 'String/*1*/' can't be assigned to the parameter type 'String/*2*/'.
- 'String/*1*/' is from 'package:time_tracking_andrea_udemy_project/services/database.dart' ('lib/services/database.dart').
- 'String/*2*/' is from 'dart:core'.
final jobsCollection = _instance.collection(path);
^
lib/services/database.dart:72:45: Error: The argument type 'Map<String/*1*/, dynamic>' can't be assigned to the parameter type 'Map<String/*2*/, dynamic>'.
- 'Map' is from 'dart:core'.
- 'String/*1*/' is from 'dart:core'.
- 'String/*2*/' is from 'package:time_tracking_andrea_udemy_project/services/database.dart' ('lib/services/database.dart').
.map((document) => builder(document.data()))
暴露给主机端口8080
。
命令:
6000
docker run \
-d \
--rm \
--name keycloak \
-p 6000:8080 \
-e KEYCLOAK_USER=admin \
-e KEYCLOAK_PASSWORD=admin \
quay.io/keycloak/keycloak \
-b 0.0.0.0 \
-Djboss.http.port=8080
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
71c6a8ea6529 quay.io/keycloak/keycloak "/opt/jboss/tools/do…" About an hour ago Up About an hour 8443/tcp, 0.0.0.0:6000->8080/tcp keycloak
docker inspect keycloak
"Ports": {
"8080/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "6000"
}
],
"8443/tcp": null
},
ps aux | grep docker
当我使用root 1481 0.0 0.5 1600328 83560 ? Ssl 18:17 0:02 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
root 2995 0.0 0.0 549300 4448 ? Sl 18:18 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 6000 -container-ip 172.17.0.2 -container-port 8080
root 3009 0.0 0.0 109104 5140 ? Sl 18:18 0:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/71c6a8ea6529bdcb1a04d5fa73b5ca0053a4d012905d592b6b342f1b0e8c9047 -address /run/containerd/containerd.sock -containerd-binary /usr/bin/containerd -runtime-root /var/run/docker/runtime-runc
时,它可以到达容器内的服务。 curl
curl -v http://localhost:6000/auth
当我尝试在google-chrome网络浏览器中执行相同操作时,出现了错误:
* Trying 127.0.0.1:6000...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 6000 (#0)
> GET /auth/ HTTP/1.1
> Host: localhost:6000
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Cache-Control: no-cache, must-revalidate, no-transform, no-store
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
< Referrer-Policy: no-referrer
< Content-Security-Policy: frame-src 'self'; frame-ancestors 'self'; object-src 'none';
< Date: Sun, 30 Aug 2020 17:44:03 GMT
< Connection: keep-alive
< X-Robots-Tag: none
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< X-Content-Type-Options: nosniff
< Content-Type: text/html;charset=utf-8
< Content-Length: 4070
为什么Google Chrome浏览器无法使用This site can’t be reached
The webpage at http://localhost:6000/auth/ might be temporarily down or it may have moved permanently to a new web address.
ERR_UNSAFE_PORT
和公开端口访问docker服务?