小编Kur*_*eek的帖子

如何查看docker-compose文件版本?

我想确保我使用的是撰写文件格式的第3版.但是,在https://docs.docker.com/compose/compose-file/上我无法找到如何执行此操作.

我的Docker版本是17.04.0-ce, build 4845c56,我的Docker-Compose版本是docker-compose version 1.9.0, build 2585387.但是,我不确定从何时引入了撰写文件格式的第3版.我怎么能找到这个?

docker docker-compose

10
推荐指数
2
解决办法
1万
查看次数

flexGrow 在 Material UI 网格的父 div 中的用途?

我试图理解这个代码示例,https://codesandbox.io/s/9rvlm,从(在物料UI文档的例子https://material-ui.com/components/grid/):

import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import Paper from '@material-ui/core/Paper';
import Grid from '@material-ui/core/Grid';

const styles = theme => ({
  root: {
    flexGrow: 1,
  },
  paper: {
    padding: theme.spacing(2),
    textAlign: 'center',
    color: theme.palette.text.secondary,
  },
});

function CenteredGrid(props) {
  const { classes } = props;

  return (
    <div className={classes.root}>
      <Grid container spacing={3}>
        <Grid item xs={12}>
          <Paper className={classes.paper}>xs=12</Paper>
        </Grid>
        <Grid item xs={6}>
          <Paper className={classes.paper}>xs=6</Paper>
        </Grid>
        <Grid item xs={6}>
          <Paper …
Run Code Online (Sandbox Code Playgroud)

css flexbox reactjs material-ui

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

部署 React 应用程序后,Github 页面仍显示 README

我有一个create-react-app项目(https://github.com/khpeek/beomaps/tree/master),我想使用gh-pages将其部署到 Github页面。按照本教程https://medium.com/@serverlessguru/deploy-reactjs-app-with-s3-static-hosting-f640cb49d7e6,我已将以下内容添加到我的package.json:

在此处输入图片说明

但是,如果我运行npm run deploy,它会被发布,

在此处输入图片说明

但是 Github 页面https://khpeek.github.io/beomaps/仍然显示基于README.md. 我可能需要更改部署目录吗?

deployment github-pages reactjs

10
推荐指数
2
解决办法
8367
查看次数

将 CSV 写入临时文件时,“类型错误:需要类似字节的对象,而不是‘str’”

我正在尝试测试一个使用 .csv 文件将数据写入 CSV 文件的函数tempfile.TemporaryFile。这是我正在尝试做的简化版本:

import csv
import tempfile


def write_csv(csvfile):
    writer = csv.DictWriter(csvfile, fieldnames=['foo', 'bar'])

    writer.writeheader()
    writer.writerow({'foo': 1, 'bar': 2})


def test_write_csv():
    with tempfile.TemporaryFile() as csvfile:
        write_csv(csvfile)
Run Code Online (Sandbox Code Playgroud)

这似乎与csv.DictWriter记录方式一致,但是当我运行测试(使用pytest)时,出现以下错误:

============================================================ FAILURES ============================================================
_________________________________________________________ test_write_csv _________________________________________________________

    def test_write_csv():
        with tempfile.TemporaryFile() as csvfile:
>           write_csv(csvfile)

csvtest.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ …
Run Code Online (Sandbox Code Playgroud)

python csv

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

如何在Linux中显示每个子目录的磁盘使用情况?

我有一个目录,/var/lib/docker其中包含几个子目录:

/var/lib/docker$ sudo ls
aufs  containers  image  network  plugins  swarm  tmp  trust  volumes
Run Code Online (Sandbox Code Playgroud)

我想知道每个目录有多大.但是,使用du如下命令,

/var/lib/docker$ sudo du -csh .
15G .
15G total
Run Code Online (Sandbox Code Playgroud)

我没有看到每个目录的"细分".在我在http://www.tecmint.com/check-linux-disk-usage-of-files-and-directories/中看到的示例中,似乎我应该看到它.我如何获得此概述以查看哪个目录占用的空间最多?

linux bash

9
推荐指数
3
解决办法
8681
查看次数

如何在运行redis:alpine Docker镜像时修复警告

如果我使用命令运行redis:alpine Docker镜像

docker run redis:alpine
Run Code Online (Sandbox Code Playgroud)

我看到几个警告:

1:C 08 May 08:29:32.308 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.2.8 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 1
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'| …
Run Code Online (Sandbox Code Playgroud)

redis docker

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

如何迭代S3存储桶中的文件?

我有一个存储在S3存储桶中的大量文件(> 1,000),我想迭代它们(例如在for循环中)以使用它们从中提取数据boto3.

但是,我注意到,根据http://boto3.readthedocs.io/en/latest/reference/services/s3.html#S3.Client.list_objects,该类的list_objects()方法Client仅列出最多1,000个对象:

In [1]: import boto3

In [2]: client = boto3.client('s3')

In [11]: apks = client.list_objects(Bucket='iper-apks')

In [16]: type(apks['Contents'])
Out[16]: list

In [17]: len(apks['Contents'])
Out[17]: 1000
Run Code Online (Sandbox Code Playgroud)

但是,我想列出所有对象,即使有超过1,000个.我怎么能实现这个目标?

python amazon-s3 amazon-web-services boto3

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

Kotlin编译“错误:Android Gradle插件仅支持1.3.0或更高版本的Kotlin Gradle插件。” 但在build.gradle中没有kotlin_version?

我尝试克隆并构建此项目https://github.com/mitrejcevski/ui-testing,但是在Android Studio中打开它后,出现以下构建错误:

ERROR: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher.
The following dependencies do not satisfy the required version:
root project 'ui-testing' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.21
Affected Modules: app
Run Code Online (Sandbox Code Playgroud)

但是,当我单击“ app”超链接时,我被带到模块级build.gradle文件,该文件显示为

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "nl.jovmit"
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    productFlavors { …
Run Code Online (Sandbox Code Playgroud)

android gradle kotlin

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

gopls 对 github.com/Shopify/sarama 返回错误“gopls:没有返回包:packages.Load 错误”

我已经检查了(at commit )main的分支,但我注意到在 VS Code 中我无法像往常一样“转到定义”。如果我将鼠标悬停在 中的包名称上,我会收到 linter 警告github.com/Shopify/sarama947343309601b4eb3c2fa3e7d15d701b503dd491 saramafunctional_consumer_group_test.go

No packages found for open file /Users/kurtpeek/go/src/github.com/Shopify/sarama/functional_consumer_group_test.go: <nil>.
If this file contains build tags, try adding "-tags=<build tag>" to your gopls "buildFlags" configuration (see (https://github.com/golang/tools/blob/master/gopls/doc/settings.md#buildflags-string).
Otherwise, see the troubleshooting guidelines for help investigating (https://github.com/golang/tools/blob/master/gopls/doc/troubleshooting.md).go list
Run Code Online (Sandbox Code Playgroud)

(参见下面的屏幕截图)。

在此输入图像描述

从命令行,如果我尝试gopls该文件,我会收到类似的错误:

> gopls check functional_consumer_group_test.go 
gopls: no packages returned: packages.Load error
Run Code Online (Sandbox Code Playgroud)

我怀疑这与该文件中的构建约束( https://pkg.go.dev/cmd/go#hdr-Build_constraints )有关,来自https://github.com/Shopify/sarama/blob/947343309601b4eb3c2fa3e7d15d701b503dd491 /function_consumer_group_test.go#L1-L2,

No packages found for open file /Users/kurtpeek/go/src/github.com/Shopify/sarama/functional_consumer_group_test.go: <nil>.
If this …
Run Code Online (Sandbox Code Playgroud)

go sarama

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

用于Alpine Linux的“ --update add”命令的说明

我想了解Dockerfile https://hub.docker.com/r/rdsubhas/tor-privoxy-alpine/~/dockerfile/,其中包含一个RUN执行官

apk --update add privoxy tor@testing runit@testing
Run Code Online (Sandbox Code Playgroud)

我想检查一下我对apk命令用法的理解,因此我尝试如下在Alpine环境中打开终端:

docker run -it --rm alpine:latest /bin/ash
Run Code Online (Sandbox Code Playgroud)

之后,我只是跑去apk看看它的用法:

/ # apk
apk-tools 2.6.8, compiled for x86_64.

usage: apk COMMAND [-h|--help] [-p|--root DIR] [-X|--repository REPO]
           [-q|--quiet] [-v|--verbose] [-i|--interactive] [-V|--version]
           [-f|--force] [-U|--update-cache] [--progress] [--progress-fd FD]
           [--no-progress] [--purge] [--allow-untrusted] [--wait TIME]
           [--keys-dir KEYSDIR] [--repositories-file REPOFILE] [--no-network]
           [--no-cache] [--arch ARCH] [--print-arch] [ARGS]...

The following commands are available:
  add       Add PACKAGEs to 'world' and install (or upgrade) them, while
            ensuring …
Run Code Online (Sandbox Code Playgroud)

linux docker alpine-linux

8
推荐指数
2
解决办法
4362
查看次数