AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[docker-machine](server)

Martin Hope
Mervin Hemaraju
Asked: 2020-12-06 14:19:13 +0800 CST

Python 在导出环境变量时抛出 KeyError

  • 0

我有一个奇怪的情况,我有一个 secret.env 文件,我在其中设置了所有环境变量:

秘密.env

export TWITTER_CONSUMER_KEY="something"
export TWITTER_CONSUMER_SECRET="something"

然后我构建了一个 docker 文件来导出所有变量并像这样运行应用程序:

FROM python:3.8-slim-buster

# Set the working directory to /app
WORKDIR /app

# Copy the current directory contents into the container at /app
ADD . /app

# Install the dependencies
RUN pip install -r requirements.txt

RUN find . -name \*.pyc -delete

# Export all variables
RUN /bin/bash -c "source secret.env";

# tell the port number the container should expose
EXPOSE 8083

# run the command
ENTRYPOINT ["python", "run.py"]

但是,这引发了一个关键错误:

$ docker run --name fortweet --rm -i -t fortweet:latest bash
Traceback (most recent call last):
  File "run.py", line 1, in <module>
    from app import socketio, app
  File "/app/app/__init__.py", line 65, in <module>
    app = create_app()
  File "/app/app/__init__.py", line 38, in create_app
    my_settings = settings.TwitterSettings.get_instance()
  File "/app/app/setup/settings.py", line 47, in get_instance
    TwitterSettings()
  File "/app/app/setup/settings.py", line 14, in __init__
    self.consumer_key = os.environ["TWITTER_CONSUMER_KEY"]
  File "/usr/local/lib/python3.8/os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'TWITTER_CONSUMER_KEY'

当我在我的 Windows 上运行它时,它工作正常!

有人可以帮我吗?

ubuntu environment-variables python docker-machine
  • 1 个回答
  • 1348 Views
Martin Hope
King David
Asked: 2020-08-14 03:44:37 +0800 CST

操作系统磁盘上的 Docker VS 专用磁盘上的 docker

  • 0

我们有 57 台 rhel 服务器机器——版本 7.5

这些机器具有强大的硬件,如 128G 内存和 32 个 CPU,

我们计划在所有机器上安装 docker 服务,以便在 docker 上运行几个容器

我们面临以下困境

  1. 我们可以直接将docker安装到OS盘- sda,所以/var/lib/docker会是OS上的文件夹

或者

  1. 要为 docker 添加专用磁盘sdb,以便在sdb不是 OS 磁盘的磁盘上运行 docker,

    例如添加新磁盘 -sdb并安装sdb到/var/lib/docker

为docker添加额外的专用磁盘作为sdb是否合理,以避免OS/disk/Docker方面的性能方面 ?

performance redhat docker containers docker-machine
  • 1 个回答
  • 139 Views
Martin Hope
King David
Asked: 2020-08-13 01:02:50 +0800 CST

RHEL 7.2 上的 Docker 安装和文件系统要求

  • -1

我们有旧RHEL机器version 7.2

我们准备在这台服务器上安装 docker 服务

问题是服务器的文件系统是使用ftype=0参数创建的,而 docker 需要ftype=1

一种选择当然是使用 mkfs 格式化磁盘并使用ftype=1

但是我们想保留原来的操作系统而不是格式化磁盘

第二种选择是执行帖子中定义的步骤 - https://superuser.com/questions/1321926/recreating-an-xfs-file-system-with-ftype-1/1321963#1321963

但是这个步骤是有风险的,需要关闭服务器

尽管我们正在寻找第三种替代方案,以便在 rhel 7.2 版上实现 docker 安装ftype=0

例如,有趣的方向可能是通过向服务器添加一个新磁盘并创建XFS文件系统,使用ftype=1,但我们不确定如何在附加磁盘上定义 docker 安装(因为这个磁盘实际上没有操作系统)。

我们很乐意开箱即用地获得任何其他想法。

redhat filesystems xfs docker docker-machine
  • 2 个回答
  • 260 Views
Martin Hope
port5432
Asked: 2016-08-10 08:39:53 +0800 CST

定位 docker 容器

  • 0

我一直在玩各种docker和docker-machine教程。这是码头机器设置

$ docker-machine ls
NAME          ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER    ERRORS
aws-sandbox   *        amazonec2    Running   tcp://52.16.157.182:2376            v1.12.0
dev           -        virtualbox   Running   tcp://192.168.99.100:2376           v1.12.0

我将docker-machine理解为可以运行 1 个或多个 docker 容器的主机。就我而言,我的笔记本电脑上运行着 docker-machine,而 EC2 上运行着另一个。

同时,我已通过以下命令将 EC2 实例设置为默认值

eval $(docker-machine env aws-sandbox)

这似乎奏效了,因为aws-sandbox被标记为ACTIVE

现在我尝试将 docker 容器加载到 docker-machine 中,但我不确定这是否有效。

$ docker ps
CONTAINER ID        IMAGE                         COMMAND                  CREATED             STATUS                          PORTS                    NAMES
fd34916854bf        orchestratingdocker_web       "env"                    About an hour ago   Restarting (0) 9 minutes ago    8000/tcp                 orchestratingdocker_web_run_2
f98b49ad026a        orchestratingdocker_web       "/usr/local/bin/pytho"   About an hour ago   Restarting (0) 23 minutes ago   8000/tcp                 orchestratingdocker_web_run_1
4d2322aa402e        orchestratingdocker_nginx     "/usr/sbin/nginx"        About an hour ago   Up About an hour                0.0.0.0:80->80/tcp       orchestratingdocker_nginx_1
1b4386bcccf2        orchestratingdocker_web       "/usr/local/bin/gunic"   About an hour ago   Up About an hour                8000/tcp                 orchestratingdocker_web_1
9190ffd622ad        postgres:latest               "/docker-entrypoint.s"   About an hour ago   Up About an hour                0.0.0.0:5432->5432/tcp   orchestratingdocker_postgres_1
380d19e5c239        kitematic/hello-world-nginx   "sh /start.sh"           About an hour ago   Up About an hour                0.0.0.0:8000->80/tcp     webserver

我似乎无法使用以下任何一种连接到这些容器中的任何一个:

  • localhost:8000或者80
  • 52.16.157.182:8000或者80
  • 192.168.99.100:8000或者80

Docker 容器是否像我假设的那样位于 docker-machine 内?如果是这样,我如何列出在哪台机器上运行的内容以及为什么我不能访问正在运行的 Web 服务器?

docker docker-machine
  • 1 个回答
  • 170 Views
Martin Hope
Warrior
Asked: 2016-06-17 10:40:06 +0800 CST

在存储库 docker.io/library/nginx 中找不到标签 latest

  • 1

我正在尝试在我的 MAC 上安装 Docker。我收到以下问题

 predix-docker xxxxxx $ docker pull nginx
 Using default tag: latest
 latest: Pulling from library/nginx
 968c69f18673: Pulling fs layer
 963493e54e68: Layer already being pulled by another client. Waiting.
 755b4eb93a9e: Layer already being pulled by another client. Waiting.
 f3b2532b0301: Layer already being pulled by another client. Waiting.
 f3bf4daa2ff2: Layer already being pulled by another client. Waiting.
6685b2154893: Layer already being pulled by another client. Waiting.
a2295636c7aa: Already exists
3035387b9e83: Already exists
 Pulling repository docker.io/library/nginx
Tag latest not found in repository docker.io/library/nginx

当我检查 Docker 映像时,我没有找到 nginx 存储库。怎么下载,求大神帮忙。

docker docker-machine
  • 2 个回答
  • 4167 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve