且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Rails服务器仍在新打开的Docker容器中运行

更新时间:2023-10-17 22:03:52

onbuild映像,因此您的工作目录已安装在容器映像中。这对开发非常有用,因为在编辑代码时会实时更新应用程序,并且例如在运行迁移时会更新主机系统。

You are using an onbuild image, so your working direcotry is mounted in the container image. This is very good for developing, since your app is updated in realtime when you edit your code, and your host system gets updated for example when you run a migration.

这也意味着,每次服务器运行时,主机系统tmp目录将与pid文件一起写入,如果服务器未正确关闭,该目录将保留在该文件中。

This also means that your host system tmp directory will be written with the pid file every time a server is running and will remain there if the server is not shut down correctly.

从主机系统运行以下命令:

Just run this command from your host system:

sudo rm tmp/pids/server.pid 

例如当您在docker-compose下使用工头时,这可能是很痛苦的,因为仅按ctrl + c不会删除pid文件

This can be a real pain when you are for example using foreman under docker-compose, since just pressing ctrl+c will not remove the pid file.