Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker存档 #81

Open
yihong0618 opened this issue Nov 20, 2019 · 5 comments
Open

docker存档 #81

yihong0618 opened this issue Nov 20, 2019 · 5 comments
Labels
技术文章 技术文章

Comments

@yihong0618
Copy link
Owner

docker 拷贝文件

{host} docker run -v /path/to/hostdir:/mnt --name my_container my_image
{host} docker exec -it my_container bash
{container} cp /mnt/sourcefile /path/to/destfile

docker cp foo.txt mycontainer:/foo.txt

@yihong0618 yihong0618 added the 技术文章 技术文章 label Nov 20, 2019
@yihong0618
Copy link
Owner Author

Backup

docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql

Restore

cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE

@yihong0618
Copy link
Owner Author

  1. docker 可以update
    https://docs.docker.com/engine/reference/commandline/update/
  2. docker update端口
docker stop test01
docker commit test01 test02
docker run -p 8080:8080 -td test02

@yihong0618
Copy link
Owner Author

更改全部为restart-always

docker container update --restart=always $(docker inspect -f "{{print .Config.Hostname ' ' .HostConfig.RestartPolicy }}" $(docker ps | awk '{print $1}' | xargs) | awk '/no/ {print substr($1,0,10)}' )

@yihong0618
Copy link
Owner Author

@yihong0618
Copy link
Owner Author

傻逼 docker !!!!

如何解决这个傻逼错误 docker/for-win#4884

试验了一个小时:

如果用 wsl 的话,这里面大多数解决方案都是错的。
正确的:

  1. 找到 window host 文件
  2. host registry-1.docker.io | awk '{print $4 "\t" $1}'
  3. 步骤 2 output 放在 host 里
  4. 重启
  5. 如果不行 8.8.8.8 也加上
  6. 再不行,卸载 docker 再重装

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
技术文章 技术文章
Projects
None yet
Development

No branches or pull requests

1 participant