序列化不可序列化的自定义外部类(Serialize custom external class that is not serializable)
我想知道是否有可能序列化主题中描述的类。
假设我们有一个共享为二进制
DLL
文件的人的库。 此外,此lib的创建者创建了一个不可Serializable
的类。 如何序列化这样的类? 我知道我可以创建一个包含所有可以序列化的特性的双胞胎。 但是还有其他更简单的解决方案吗? 如何序列化“不属于你”并仅存储为二进制的类?I wonder if there is any possibility of serializing a class described in a topic.
Suppose we have someone's library that is shared as binary
DLL
file. Additionally a creator of this lib created a class that is notSerializable
. How to serialize such a class? I know I can create a twin-class that contains all the poperties etc. that can be serialized. But is there any other, easier solution to do this? How do you serialize classes that are "not yours" and are stored as binary only?
原文:https://stackoverflow.com/questions/23245226
最满意答案
如果你在主机上,并且想用
<
,使用pipe|
来提供一些脚本 或者只是多个命令&&
你必须使用这个bash trick/bin/bash -c "some command
来完成它,因此它会将整个命令作为一个整体传递给容器。docker exec -it local-mysql /bin/bash -c "mysql -h localhost < /data/init.sql"
if you are on host and want to feed some script with
<
, use pipe|
or just multiple commands with&&
you have to do it with this bash trick/bin/bash -c "some command
so it will pass the whole command as a whole to the container.docker exec -it local-mysql /bin/bash -c "mysql -h localhost < /data/init.sql"
相关问答
更多-
使用docker-compose up 由于您在Docker主机上发布了3306端口,因此您将连接到127.0.0.1:3306 。 使用docker-compose run 在这种情况下, docker-compose.yml文件的端口映射部分将被忽略。 要考虑端口映射部分,您必须添加--service-ports选项: docker-compose run --service-ports db 附加说明 请注意,默认情况下,当您告诉mysql连接到localhost时,mysql客户端会尝试使用uni ...
-
有什么数据库专业书籍介绍?[2022-05-19]
mysql -
我相信@jripoll是不正确的,它似乎运行的第一次在docker start上运行docker run的命令。 这里有一个简单的例子来测试: 首先创建一个名为tmp.sh的shell脚本: echo "hello yo!" 然后运行: docker run --name yo -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp ubuntu sh tmp.sh 这将打印hello yo! 。 现在再次启动它: docker start -ia yo 每次运行时 ...
-
您可以使用system命令。 系统命令,\! 命令 使用默认的命令解释器执行给定的命令。 系统命令仅适用于Unix。 例: system ls -l You can use the system command. system command, \! command Executes the given command using your default command interpreter. The system command works only in Unix. Example: system ...
-
如果您通过HTTPS访问Docker守护程序,则可以从远程计算机或Docker容器中与守护程序进行通信。 有关在守护进程中启用HTTPS的说明,请访问https://docs.docker.com/articles/https/ 简而言之,它涉及到创建客户端和服务器证书(为了安全)以及使用命令(例如)运行Docker守护进程 docker -d --tlsverify --tlscacert=ca.pem \ --tlscert=server-cert.pem --tlskey=server-key.pem ...
-
docker-compose run将在同一网络上启动一个名为folder_db_container_run_1的新容器。 这不是运行mysql,因为你传递了一个命令。 所以它正在运行该命令。 因此,您从此容器连接到原始数据库容器 docker-compose run db_container mysql -uuser -ppass db_name -h db_container 当你执行exec时,你进入正在运行的容器。 而不指定主机意味着本地mysql docker-compose exec db_c ...
-
python docker客户端不能以正确的方式执行mysql命令(python docker client does not execute mysql command in a right way)[2023-11-29]
如果你在主机上,并且想用< ,使用pipe |来提供一些脚本 或者只是多个命令&&你必须使用这个bash trick /bin/bash -c "some command来完成它,因此它会将整个命令作为一个整体传递给容器。 docker exec -it local-mysql /bin/bash -c "mysql -h localhost < /data/init.sql" if you are on host and want to feed some script with <, use pipe ... -
如果mysqld是参数,则entyrypoint scipt仅执行initdb; 在你的情况下,它会看到bash ,因此跳过initdb并仅用它的参数运行bash。 如果你只是试图运行一些安装脚本,一旦mysql正在运行,你看过/docker-entrypoint-initdb.d/ ? 创建一个docker-compose.yml version: '2' services: db: image: mysql container_name: mysql res ...
-
您可以登录OpenShift的内部图像注册表并直接将图像推送到它。 您需要首先标记图像,使其与推送图像的项目名称相匹配。 有关更多详情,请参阅 http://cookbook.openshift.org/image-registry-and-image-streams/how-do-i-push-an-image-to-the-internal-image-registry.html 一旦推送到内部映像注册表,您就可以使用oc new-app或Web控制台从该映像进行部署。 You can login to ...
-
按照本教程,您需要docker pull jenkins机器上,而不是放在容器内。 当你做docker run -it ubuntu bash你会进入ubuntu docker容器的shell。 为了能够在容器内拉取jenkins图像,您需要有DND(docker-in-docker),您的VM上的docker套接字被安装在容器中,您可以在其中运行任何docker命令。 所以如果你想在容器中运行任何docker命令,可以使用https://hub.docker.com/_/docker/这个镜像或者运行do ...