小编jmt*_*b28的帖子

Docker 不支持使用 Docker 工具箱在 Windows 家庭系统上存储机密

在 Windows 10 Home 上使用 Docker 工具箱,Docker 版本 19.03,我们创建了一个docker-compose.yml并添加了一个机密文件作为 JSON,它在 Mac 系统上运行良好,但无法在 Windows 10 Home 中运行。

运行后报错docker-compose up

ERROR: for orthancserver  Cannot create container for service orthanc: invalid mount config for type 
"bind": invalid mount path: 'C:/Users/ABC/Desktop/Project/orthanc.json' mount path must be absolute
Run Code Online (Sandbox Code Playgroud)

docker-compose.yml

version: "3.7"

services: 
    orthanc:
        image: jodogne/orthanc-plugins:1.6.1
        command: /run/secrets/
        container_name: orthancserver
        restart: always
        ports: 
            - "4242:4242"
            - "8042:8042"
        networks: 
            - mynetwork
        volumes: 
            - /tmp/orthanc-db/:/var/lib/orthanc/db/
        secrets:
            - orthanc.json    
    dcserver:
        build: ./dc_node_server
        depends_on:
            - orthanc …
Run Code Online (Sandbox Code Playgroud)

docker docker-compose docker-toolbox docker-for-windows orthanc-server

6
推荐指数
1
解决办法
485
查看次数

如何阅读/理解 docker-compose.yml 以及“stdin_open: true tty: true”组件的作用?

参加涉及这些问题的课程;实际细节与课程无关,但我通常有兴趣尝试理解事物。

我有一个 docker-compose.yml 文件,我可以“调用”或“启动”该文件。该文件包含以下信息:

services:
  redis:
    image: redis:latest
    expose:
      - "6379"

  sample0395:
    image: sample0395/base:latest
    stdin_open: true
    tty: true
    expose:
      - "8888"
    ports:
      - "8888:8888"
Run Code Online (Sandbox Code Playgroud)

据我了解,仅基于如图所示的层次结构:

  • redis 和sample0395 是“服务”
  • redis:latest 和 sample0395/base:latest 是 image_name:tag 组合
  • 暴露和端口:列出端口(不确定有什么区别或这两者之间的区别的意义是什么)
  • 我不知道 stdin_open 或 tty 做什么,并且似乎无法通过谷歌获得理解。

yaml docker-compose

4
推荐指数
1
解决办法
4280
查看次数

pandas 数据帧中特定列后的第一个给定大小的零序列的长度

假设我有一个像这样的数据框:

        ID      0   1   2   3   4   5   6   7   8   ... 81  82  83  84  85  86  87  88  89  90  total  day_90
-------------------------------------------------------------------------------------------------------------
0       A       2   21  0   18  3   0   0   0   2   ... 0   0   0   0   0   0   0   0   0   0    156   47
1       B       0   20  12  2   0   8   14  23  0   ... 0   0   0   0   0   0   0   0   0   0    231   35
2       C       0   38  19  3   1 …
Run Code Online (Sandbox Code Playgroud)

python pandas

3
推荐指数
1
解决办法
1031
查看次数

带有外键的 Django ModelForm

我正在尝试创建一个ModelForm用外键更新表的表。我所拥有的似乎有效,但我希望有人能告诉我是否有更好的方法来做到这一点,或者我在下面做的方式是否有问题。

Author在and表上使用查询集是否正确Genres?感觉我应该在Book模型上使用查询集,并将外键与这些表相关联。

models.py:

class Author(models.Model):
    name = models.CharField(max_length=200)
    
class Genre(models.Model):
    name = models.CharField(max_length=200)
    
class Book(models.Model):
    title = models.CharField(max_length=200)
    author = models.ForeignKey('Author')
    genre = models.ForeignKey('Genre')
Run Code Online (Sandbox Code Playgroud)

forms.py:

class BookForm(ModelForm):
    title = forms.CharField(max_length=200)
    author = forms.ModelChoiceField(queryset=Author.objects.all())
    genre = forms.ModelChoiceField(queryset=Genre.objects.all())

    class Meta:
        model = Book
        fields = ['title', 'author', 'genre']
Run Code Online (Sandbox Code Playgroud)

views.py:

def add_book(request):
    if request.method == 'POST':
        form = BookForm(request.POST)
        if form.is_valid():
            form.save(commit=True)
            return HttpResponseRedirect('/add/')
    else:
        form = BookForm()
Run Code Online (Sandbox Code Playgroud)

python django

1
推荐指数
1
解决办法
5539
查看次数