Rails server is still running in a new opened docker container

前端 未结 9 1336
面向向阳花
面向向阳花 2021-01-31 08:05

I want to deploy my rails project using Docker. So I use Docker-Compose. But I get one weird error message. When run docker-compose up(this contains db-container with postgresql

9条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-31 08:24

    If you are feeling adventurous feel free to search for server.pid in the codebase and check where the pid is getting written into. That way you can check if not allowing it to write fixes the root problem for you. Because seemingly the pid creation helps prevent you from running duplicate services in two different docker containers. But that should be taken care of in docker as it is. If for some reason, it does not, the port collision methodology should definitely take care of that and alert you. Note: I have not tried this approach as yet as that is moving the system in general:)

    Alternatively, you could have commands in your Makefile. Where the task does this:

    task:
    docker-compose stop service_name
    docker-compose rm service_name
    rm -f ./tmp/pids/server.pid (or relative pathname of your pid file)
    docker-compose up service_name

    And then vrooom make task in terminal and hit enter. The above task commands assume the service you want to run are in a file named docker-compose.yml

    If the name is different then the command

    docker-compose stop service_name --> docker-compose -f your-compose-filename.yml stop service_name

    so on and so forth.

    ==================== Came back to update this. So, I did try commenting out my write_pid method functionality. Basically keep the method definition, but not have it do anything. It is working well so far. It does not write the pid at all. If you are running your services in docker, I believe this is completely safe.

提交回复
热议问题