当dagster脚本从docker容器内部运行时,无法在本地计算机上打开Dagster UI

xvw2m8pv  于 2023-06-21  发布在  Docker
关注(0)|答案(1)|浏览(150)

我在尝试从Docker容器中打开Dagster UI时遇到了一个问题。此外,这是朝着我更大的目标迈出的一步,从Docker容器打开dagster UI,这在Google Compute Engine上运行。我可以在本地打开和查看dagster UI,当它不在容器内时。这里有一些图表来解释我的问题和目标。

我的问题:
当dagster脚本从docker容器内部运行时,我无法在本地机器上打开Dagster UI。

我尝试过的:

# My docker image:

FROM python:3.8-slim-buster

# This is to deal with an issue with the psutil package.
RUN apt-get update -y && apt-get install -y gcc
RUN apt-get -y install xauth

COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt

COPY . .

EXPOSE 3000

CMD dagster dev -f run_dagster_pipeline.py

# Building the container. 

docker build -t py-gce .

# Output:

=> [internal] load build definition from Dockerfile                                            0.0s
 => => transferring dockerfile: 553B                                                            0.0s
 => [internal] load .dockerignore                                                               0.0s
 => => transferring context: 2B                                                                 0.0s
 => resolve image config for docker.io/docker/dockerfile:1                                      1.2s
 => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:39b85bbfa7536a5feceb7372a081764  0.0s
 => [internal] load build definition from Dockerfile                                            0.0s
 => [internal] load .dockerignore                                                               0.0s
 => [internal] load metadata for docker.io/library/python:3.8-slim-buster                       0.8s
 => [internal] load build context                                                               0.2s
 => => transferring context: 375.92kB                                                           0.2s
 => [1/6] FROM docker.io/library/python:3.8-slim-buster@sha256:eb48d017c5e117d9fbcbe991b4dbc61  0.0s
 => CACHED [2/6] RUN apt-get update -y && apt-get install -y gcc                                0.0s
 => [3/6] RUN apt-get -y install xauth                                                          1.5s
 => [4/6] COPY requirements.txt requirements.txt                                                0.0s 
 => [5/6] RUN pip3 install -r requirements.txt                                                 68.0s 
 => [6/6] COPY . .                                                                              0.3s 
 => exporting to image                                                                          2.2s 
 => => exporting layers                                                                         2.2s 
 => => writing image sha256:34ffd1197f7235be0493d3be985d70a053c2a48b9c421ee328e0f324b041dd13    0.0s 
 => => naming to docker.io/library/py-gce                                                       0.0s

# Running the container and porting to different port. 

docker run -p 8080:3000 py-gce

# Output:

2023-06-03 17:37:12 +0000 - dagster - INFO - Using temporary directory /tmpkcsq9so9 for storage. This will be removed when dagster dev exits.
2023-06-03 17:37:12 +0000 - dagster - INFO - To persist information across sessions, set the environment variable DAGSTER_HOME to a directory to use.
2023-06-03 17:37:12 +0000 - dagster - INFO - Launching Dagster services...

  Telemetry:

  As an open source project, we collect usage statistics to inform development priorities. For more
  information, read <https://docs.dagster.io/getting-started/telemetry>.

  We will not see or store solid definitions, pipeline definitions, modes, resources, context, or
  any data that is processed within solids and pipelines.

  To opt-out, add the following to $DAGSTER_HOME/dagster.yaml, creating that file if necessary:

    telemetry:
      enabled: false

  Welcome to Dagster!

  If you have any questions or would like to engage with the Dagster team, please join us on Slack

2023-06-03 17:37:14 +0000 - dagster.daemon - INFO - Instance is configured with the following daemons: ['AssetDaemon', 'BackfillDaemon', 'SchedulerDaemon', 'SensorDaemon']
2023-06-03 17:37:14 +0000 - dagster.daemon.SensorDaemon - INFO - Not checking for any runs since no sensors have been started.
2023-06-03 17:37:14 +0000 - dagit - INFO - Serving dagit on <http://127.0.0.1:3000> in process 9
2023-06-03 17:38:14 +0000 - dagster.daemon.SensorDaemon - INFO - Not checking for any runs since no sensors have been started.

# Go to open the web UI trying these URLs:

<http://localhost:8080/>
<http://localhost:3000/>
http://localhost:127.0.0.1:3000
http://localhost:127.0.0.1:8080
http://localhost:0.0.0.0:8080
http://localhost:0.0.0.0:3000

<http://127.0.0.1:3000>
http://127.0.0.1:0.0.0.0:3000
<http://0.0.0.0:3000>

<http://127.0.0.1:8080>
http://127.0.0.1:0.0.0.0:8080
<http://0.0.0.0:8080>

但我得到的只有:
“无法访问此站点”

# The next thing I try is to search the IP address for my docker container 
# using the following commands:

docker ps

# To get my docker image ID

docker inspect "my address"

# I search for my DOCKER IP address and get:
"IPAddress": "172.17.0.2",

# Then I try these URL's

http://localhost:172.17.0.2:8080
http://localhost:172.17.0.2
http://localhost:172.17.0.2:3000
<http://172.17.0.2:8080>

这些都不管用然而,这一次它失败是因为它被卡住了,而不是因为它被立即拒绝了。
我发现这篇文章,他们说:172.17.0.2 IP地址位于运行Docker引擎的虚拟机内部。您将无法从Windows主机访问它。该虚拟机的实际IP地址应该是192.168.99.100,如果实际上Map了任何端口,则端口将Map到该IP。”
https://forums.docker.com/t/unable-to-access-my-first-container-on-172-17-0-2/54106
看起来他们是从运行docker-machine IP获取192.168.99.100 IP;但是,我机器上没有Docker机器。我下载了它,但仍然失败,然后继续阅读,192.168.99.100是默认值,所以不应该是唯一的,为我的机器无论如何。
“无法访问此站点:192.168.99.100响应时间过长”
我在这一点上相当迷失,已经尝试了几个小时来解决这个看似简单的任务!
此外,就像我的第一个图表中所示的那样,这只是朝着我的最终目标迈出的一步,即从GCE中的Docker容器中打开Dagster UI。所以,如果你有任何提示,endevor,随时提出建议,以及。
我一直在向上向下堆栈溢出,发现类似的问题,但解决方案对我不起作用。我不确定这是Dagster问题还是Docker问题。

14ifxucb

14ifxucb1#

试试这个命令:在Dockerfile中使用dagit -h 0.0.0.0 -p 3000而不是dagster dev。由于需要打开dagster UI,使用dagit更合理。

相关问题