小编Mos*_*ein的帖子

备份泊坞窗卷 - 简单的tar归档是不够的?

我在三台机器上运行几个Docker容器,组成一个Swarm集群.

一些存储持久数据的容器(如DB,Redis等)使用数据卷.(我尽量避免使用bind-mount)

此类数据卷位于/ var/lib/docker/volumes /中,并为每个卷分配自定义名称而不是随机序列ID:

# ls /var/lib/docker/volumes/
redis-data   postgres-data   fluentd-data ...
Run Code Online (Sandbox Code Playgroud)

我想每天定期备份这些卷,例如每天,以便我可以在发生机器故障时进行恢复并在以后修复.

但是,我在google中找到的每个文档都说明了使用新Linux容器的方法,并且tar:

https://docs.docker.com/storage/volumes/#backup-restore-or-migrate-data-volumes

$ docker run --rm --volumes-from dbstore -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /dbdata
Run Code Online (Sandbox Code Playgroud)

为什么?如果我只是归档/var/lib/docker/volumes/VOLUME目录并将其复制到其他机器有什么问题吗?例如,权限,uid,gid等?

$ tar -zcvf redis.tgz /var/lib/docker/volumes/redis-data
Run Code Online (Sandbox Code Playgroud)

PS

有一种情况是,备份使用tar可能会因归档期间数据的更改而导致数据不一致.例如,当DB仍在运行并且执行inserts或updates 时归档DB数据目录......但我认为这个问题以相同的方式应用于这两种方法.

backup docker docker-volume

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

bootstrap_form错误未定义方法

1-我安装了gem bootstrap_form
2-我在application.css中写*= require bootstrap_form before the */
了我的html.erb中的第3 行

<%= bootstrap_form_for(@guardian, :url => student_guardians_path(@student),
html: { class: 'form-horizontal' },
method: :post) do |f| %>
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:undefined methodbootstrap_form_for'for#<#:0xb31a80c>`

forms ruby-on-rails ruby-on-rails-3

8
推荐指数
3
解决办法
2975
查看次数

Docker Anonymous Volumes

我在docker-compose.yml文件中看到了Docker卷定义,如下所示:

-v /path/on/host/modules:/var/www/html/modules
Run Code Online (Sandbox Code Playgroud)

我注意到Drupal的官方图片,他们的docker-compose.yml文件使用的是匿名卷.

注意评论:

volumes:
  - /var/www/html/modules
  - /var/www/html/profiles
  - /var/www/html/themes
  # this takes advantage of the feature in Docker that a new anonymous
  # volume (which is what we're creating here) will be initialized with the
  # existing content of the image at the same location
  - /var/www/html/sites
Run Code Online (Sandbox Code Playgroud)

有没有办法在容器运行后将匿名卷与主机上的路径相关联?如果没有,拥有匿名卷的重点是什么?

完整的docker-compose.yml示例:

version: '3.1'

services:

  drupal:
    image: drupal:8.2-apache
    ports:
      - 8080:80
    volumes:
      - /var/www/html/modules
      - /var/www/html/profiles
      - /var/www/html/themes
      # this takes advantage …
Run Code Online (Sandbox Code Playgroud)

docker docker-compose docker-volume

8
推荐指数
3
解决办法
3475
查看次数

Jenkins:从与代理(另一个 Docker 容器)一起运行的阶段连接到 Docker 容器

我正在重新设计管道以使用声明式管道方法,以便我能够在每个阶段使用 Docker 映像

目前我有以下工作代码,它执行连接到在 Docker 容器中运行的数据库的集成测试。

node {
    // checkout, build, test stages...
    stage('Integration Tests') {            
        docker.image('mongo:3.4').withRun(' -p 27017:27017') { c ->
        sh "./gradlew integrationTest"
    }
}
Run Code Online (Sandbox Code Playgroud)

现在使用声明式管道,相同的代码看起来像这样:

pipeline {
    agent none
    stages {
        // checkout, build, test stages...
        stage('Integration Test') {
            agent { docker { image 'openjdk:11.0.4-jdk-stretch' } }
            steps {
                script {
                    docker.image('mongo:3.4').withRun(' -p 27017:27017') { c ->
                        sh "./gradlew integrationTest"
                    }
                }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

问题:该阶段现在在 Docker 容器中运行docker.image(),并且运行会导致docker: …

jenkins docker jenkins-pipeline jenkins-declarative-pipeline

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

Bootstrap在rails应用程序中不起作用

我无法打开我的应用程序,因为这个错误,我试图添加,// *= require "bootstrap-responsive"但这不起作用,我也试图从自定义中删除代码并将其添加到应用程序然后重命名应用程序application.css.scss,我试图重命名自定义custom.scss只有但我找不到任何有效的解决方案.我可以做什么 ?

Sass::SyntaxError at /
File to import not found or unreadable: bootstrap-responsive.
Load paths:
  Sass::Rails::Importer(/home/dexter/Desktop/Sherif/Triton/app/assets/stylesheets/custom.css.scss)
  /home/dexter/.rvm/gems/ruby-1.9.3-p194/gems/bootstrap-sass-3.0.2.1/vendor/assets/stylesheets
  (in /home/dexter/Desktop/Sherif/Triton/app/assets/stylesheets/custom.css.scss)
Run Code Online (Sandbox Code Playgroud)

Custom.css.scss

// Example using 'Spruce' bootswatch
//
// First import variables
@import "bootswatch/cerulean/variables";

// Then bootstrap itself
@import "bootstrap";

// Bootstrap body padding for fixed navbar
body { padding-top: 60px; }

// Responsive styles go here in case you want them
@import "bootstrap-responsive";

// And finally bootswatch style itself
@import "bootswatch/cerulean/bootswatch";

.... …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.2

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

错误:Dockerfile 中的参考格式无效 ubuntu 14.04、cuda 8.0、cudnn 6.0

我正在尝试从此处从规范 ubuntu 14.04、cuda 8.0、cudnn 6.0 (devel) 的 Dockerfile 构建镜像。

我将 dockerfile 保存在本地系统上当我使用 docker build PATH 命令时,其中

路径 = /home/anil/桌面/容器

我收到以下错误:

Sending build context to Docker daemon   2.56kB
Step 1/7 : ARG IMAGE_NAME
Step 2/7 : FROM ${IMAGE_NAME}:8.0-devel-ubuntu14.04
invalid reference format
Run Code Online (Sandbox Code Playgroud)

我使用的是 Docker 版本 18.03.1-ce,内部版本 9ee9f40

请帮我。谢谢

docker cudnn

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

Gitlab CI-错误:作业失败:执行程序需要OSType = linux,但Docker Engine仅支持OSType = windows

运行Gitlab CI管道时出现此错误。据我了解,错误表明我正在尝试在Windows docker-engine上运行Linux类型的docker映像?但问题是我正在使用Windows docker映像。可能是什么问题呢?

错误:作业失败:执行程序需要OSType = linux,但是Docker Engine仅支持OSType = windows

我的CI:

image: hello-world:nanoserver

stages:
  - build

build1:
  stage: build
  script:
    - echo "Hello world"
Run Code Online (Sandbox Code Playgroud)

gitlab docker gitlab-ci gitlab-ci-runner

3
推荐指数
2
解决办法
114
查看次数

如何删除不属于任何分支的提交?

如果我将分支A合并到分支B然后删除A,那么分支A(现已删除)的提交属于哪个分支?当我获得这些提交的链接时,我发现“此提交不属于此存储库上的任何分支,并且可能属于存储库外部的分支。”

检查此处的屏幕截图

我尝试了这个问题的所有答案,但没有解决 mu 问题 列出和删除没有分支下的 Git 提交(悬空?)

解决办法是什么?

git github

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

SaltStack处理json文件

是否可以使用状态功能处理位于minions上的saltstack来处理json文件?

我确信应该可以使用jinja的功能,但找不到任何信息.

json salt jinja2 salt-stack

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