简体   繁体   English

sql转储是否被加密到docker容器docker-entrypoint-initdb.d中?

[英]Are sql dumps moved into docker container `docker-entrypoint-initdb.d` encrypted?

I'm dumping a database into a sql dump: 我正在将数据库转储到sql转储中:

docker exec mysql sh -c 'exec mysqldump --all-databases -uroot -ppassword' > all-databases.sql

Then I'm using a Dockerfile to build a mysql image and run as a container: 然后,我使用Dockerfile构建mysql映像并作为容器运行:

FROM mysql:5.6.41

# needed for intialization
ENV MYSQL_ROOT_PASSWORD=whateverPassword

ADD all-databases.sql /docker-entrypoint-initdb.d/

EXPOSE 3306

When I run the container if I exec into the container, can I access the all-databases.sql file and see the contents of my database in plaintext in the docker image? 当我执行到容器时运行容器时,是否可以访问all-databases.sql文件,并在docker映像中以纯文本格式查看数据库的内容?

Currently if I look into /docker-entrypoint-initdb.d/ it says all-databases.sql but I don't know where that file is stored/if it's encrypted. 目前,如果我查看/docker-entrypoint-initdb.d/它显示为all-databases.sql,但我不知道该文件的存储位置/是否已加密。

If you docker exec into the container, the file will be unencrypted. 如果您将docker exec放入容器中,该文件将不会被加密。 (It's just a text file and you can look at it with more on most image bases.) (这只是一个文本文件,您可以在大多数图像库中查看more内容。)

However, if you can run any Docker command at all, then generally it's trivial to get unrestricted root access on the system. 但是,如果您完全可以运行任何Docker命令,那么通常很难在系统上获得不受限制的root用户访问权限。 (Consider using docker run -v /etc:/host-etc to add yourself to /etc/sudoers or to allow root logins with no password.) (考虑使用docker run -v /etc:/host-etc将自己添加到/etc/sudoers或允许不使用密码的root用户登录。)

Also remember that anyone who has the image can docker run it and see the file there, if that matters to your security concerns. 还要记住,如果对您的安全性很重要,那么拥有映像的任何人都可以通过docker run它并在那里查看文件。 If you're looking for a single file with root access on the system anyways, you can find it without too much effort in /var/lib/docker . 如果您一直在寻找一个具有系统根访问权限的文件,则可以在/var/lib/docker轻松找到它。 They can also easily run docker history to see the database root password you've set. 他们还可以轻松地运行docker history来查看您设置的数据库根密码。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 docker-compose up invalid mode /docker-entrypoint-initdb.d/ - 无法为服务数据库创建容器 - docker-compose up invalid mode /docker-entrypoint-initdb.d/ - cannot create container for service database 无法使用 mysql docker 容器在 docker-entrypoint-initdb.d 中创建数据库 - Can't create db in docker-entrypoint-initdb.d with mysql docker container 当容器从另一个容器中启动时,docker-entrypoint-initdb.d 为空 - docker-entrypoint-initdb.d is empty when container is started from within another container 自定义mysql高山映像未从作为卷安装的docker-entrypoint-initdb.d加载init.sql - Custom mysql alpine image not loading init.sql from docker-entrypoint-initdb.d mounted as a volume docker 权限被拒绝 mysql 映像中的 shell 脚本放置在 docker-entrypoint-initdb.d - docker permission denied for shell script in mysql image placed at docker-entrypoint-initdb.d 如何等待docker-entrypoint-initdb.d在Shell脚本/ Bash中加载数据库? - How to wait for docker-entrypoint-initdb.d to load DB in Shell Script/Bash? 为什么我的 docker-entrypoint-initdb.d 脚本(在 docker-compose.yml 中指定)没有被执行来初始化一个新的 MySQL 实例? - Why isn't my docker-entrypoint-initdb.d script (as specified in docker-compose.yml) executed to initialize a fresh MySQL instance? 命令&#39;/ bin / sh -c mysql -u wordpress -pwordpress wordpress &lt;/docker-entrypoint-initdb.d/wordpress.sql&#39;返回非零代码:1 - The command '/bin/sh -c mysql -u wordpress -pwordpress wordpress < /docker-entrypoint-initdb.d/wordpress.sql' returned a non-zero code: 1 docker-entrypoint-initdb 中的 MySQL 脚本不执行 - MySQL scripts in docker-entrypoint-initdb are not executed 使用 Docker SQL 或 Docker MongoDB 容器连接元数据库 - Connecting Metabase with Docker SQL or Docker MongoDB container
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM