Docker container exits immediately after running or restarting PostgreSQL image












1















I am begginer with docker, and I stuck in place due to container restarting problem.
The problem occures when I try to restart an existing exited container, or create new container (after deleting old one) running:



docker run -d --name mempostgres 
-v "/home/lukasz/lc_pg_data:/var/lib/pgsql/data:Z"
-e POSTGRES_USER=postgres
-e POSTGRES_PASSWORD=password
-e POSTGRES_DB=dbName
-p 5432:5432
fedora/postgresql


My container always exits immediately with status "Exited(1)"



Inside the logs of my container i have:
enter image description here



However I don't have any PostgreSQL server running at this moment.










share|improve this question

























  • Not an answer but the image isn't really up to date. I would recommend to use the official postgres image: hub.docker.com/_/postgres

    – lvthillo
    Jun 12 '17 at 10:55











  • If you are sure that there is no another Postgres running, delete that .pid file.

    – Robert
    Jun 12 '17 at 11:35
















1















I am begginer with docker, and I stuck in place due to container restarting problem.
The problem occures when I try to restart an existing exited container, or create new container (after deleting old one) running:



docker run -d --name mempostgres 
-v "/home/lukasz/lc_pg_data:/var/lib/pgsql/data:Z"
-e POSTGRES_USER=postgres
-e POSTGRES_PASSWORD=password
-e POSTGRES_DB=dbName
-p 5432:5432
fedora/postgresql


My container always exits immediately with status "Exited(1)"



Inside the logs of my container i have:
enter image description here



However I don't have any PostgreSQL server running at this moment.










share|improve this question

























  • Not an answer but the image isn't really up to date. I would recommend to use the official postgres image: hub.docker.com/_/postgres

    – lvthillo
    Jun 12 '17 at 10:55











  • If you are sure that there is no another Postgres running, delete that .pid file.

    – Robert
    Jun 12 '17 at 11:35














1












1








1








I am begginer with docker, and I stuck in place due to container restarting problem.
The problem occures when I try to restart an existing exited container, or create new container (after deleting old one) running:



docker run -d --name mempostgres 
-v "/home/lukasz/lc_pg_data:/var/lib/pgsql/data:Z"
-e POSTGRES_USER=postgres
-e POSTGRES_PASSWORD=password
-e POSTGRES_DB=dbName
-p 5432:5432
fedora/postgresql


My container always exits immediately with status "Exited(1)"



Inside the logs of my container i have:
enter image description here



However I don't have any PostgreSQL server running at this moment.










share|improve this question
















I am begginer with docker, and I stuck in place due to container restarting problem.
The problem occures when I try to restart an existing exited container, or create new container (after deleting old one) running:



docker run -d --name mempostgres 
-v "/home/lukasz/lc_pg_data:/var/lib/pgsql/data:Z"
-e POSTGRES_USER=postgres
-e POSTGRES_PASSWORD=password
-e POSTGRES_DB=dbName
-p 5432:5432
fedora/postgresql


My container always exits immediately with status "Exited(1)"



Inside the logs of my container i have:
enter image description here



However I don't have any PostgreSQL server running at this moment.







postgresql docker






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 19:20









Massimiliano Kraus

2,34541532




2,34541532










asked Jun 12 '17 at 10:42









LucasPGLucasPG

1381114




1381114













  • Not an answer but the image isn't really up to date. I would recommend to use the official postgres image: hub.docker.com/_/postgres

    – lvthillo
    Jun 12 '17 at 10:55











  • If you are sure that there is no another Postgres running, delete that .pid file.

    – Robert
    Jun 12 '17 at 11:35



















  • Not an answer but the image isn't really up to date. I would recommend to use the official postgres image: hub.docker.com/_/postgres

    – lvthillo
    Jun 12 '17 at 10:55











  • If you are sure that there is no another Postgres running, delete that .pid file.

    – Robert
    Jun 12 '17 at 11:35

















Not an answer but the image isn't really up to date. I would recommend to use the official postgres image: hub.docker.com/_/postgres

– lvthillo
Jun 12 '17 at 10:55





Not an answer but the image isn't really up to date. I would recommend to use the official postgres image: hub.docker.com/_/postgres

– lvthillo
Jun 12 '17 at 10:55













If you are sure that there is no another Postgres running, delete that .pid file.

– Robert
Jun 12 '17 at 11:35





If you are sure that there is no another Postgres running, delete that .pid file.

– Robert
Jun 12 '17 at 11:35












1 Answer
1






active

oldest

votes


















1














You need to kill that postmaster process.



cat .../postmaster.pid



The first number of this file is the PID of postmaster process.



Then, kill that process using:



kill PID



Finally, run a container, your problem should be fixed.






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44497437%2fdocker-container-exits-immediately-after-running-or-restarting-postgresql-image%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    You need to kill that postmaster process.



    cat .../postmaster.pid



    The first number of this file is the PID of postmaster process.



    Then, kill that process using:



    kill PID



    Finally, run a container, your problem should be fixed.






    share|improve this answer






























      1














      You need to kill that postmaster process.



      cat .../postmaster.pid



      The first number of this file is the PID of postmaster process.



      Then, kill that process using:



      kill PID



      Finally, run a container, your problem should be fixed.






      share|improve this answer




























        1












        1








        1







        You need to kill that postmaster process.



        cat .../postmaster.pid



        The first number of this file is the PID of postmaster process.



        Then, kill that process using:



        kill PID



        Finally, run a container, your problem should be fixed.






        share|improve this answer















        You need to kill that postmaster process.



        cat .../postmaster.pid



        The first number of this file is the PID of postmaster process.



        Then, kill that process using:



        kill PID



        Finally, run a container, your problem should be fixed.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jun 12 '17 at 12:47

























        answered Jun 12 '17 at 11:49









        kstromeiraoskstromeiraos

        2,2661018




        2,2661018






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44497437%2fdocker-container-exits-immediately-after-running-or-restarting-postgresql-image%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

            Alcedinidae

            Origin of the phrase “under your belt”?