本文介绍了无法备份docker volumne的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在从此处中备份docker的官方docker指南.我也知道这个SO问题但是我仍然遇到错误.运行以下命令:
I'm following the offical docker guide from here to backup a docker volume. I'm also aware of this SO question however I'm still running into errors. Running the following command:
docker run --rm --volumes-from dbstore -v $(pwd):/backup ny_db_1 tar cvf /backup/backup.tar /dbdata
无论我输入什么图像名称或容器名称或容器ID,都会出现以下错误:
No matter what image name or container name or container id I put, I get the following error:
Unable to find image 'ny_db_1:latest' locally
我要备份的卷:
$ docker volume ls
DRIVER VOLUME NAME
local ny_postgres_data
我的容器:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
39e71e660eda postgres:10.1-alpine "docker-entrypoint.s…" 4 days ago Up 23 minutes 0.0.0.0:5434->5433/tcp ny_db_1
如何备份我的卷?
更新:
我尝试了以下操作,但遇到了新的错误:
I tried the following but ran into a new error:
$ docker run --rm --volumes-from 39e71e660eda -v $(pwd):/backup postgres:10.1-alpine tar:local cvf /backup/backup.tar /dbdata
/usr/local/bin/docker-entrypoint.sh: line 145: exec: tar:local: not found
推荐答案
在此处尝试此命令:
docker run -it --rm -v ny_postgres_data:/volume -v /tmp:/backup ny_db_1 \
tar -cjf /backup/ny_postgres_data -C /volume ./
这篇关于无法备份docker volumne的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!