Why docker container name has an random number at the end?












5















I have a docker-compose.yml file as below (a piece of it):



version: '3.5'
services:
framework:
image: ${DOCKER_REGISTRY}/gme/fmk:${COMPOSE_PROJECT_NAME}
build: ./fmk
ports:
- "2020:2020"
- "2025:2025"
- "4999:4999"
volumes:
- ${FOLDER_ENV}/workspace/logs/framework:/var/log/gcti
- ${FOLDER_ENV}/..:/usr/local/genesys/gsg_qaart


what I got is:



vagrant@docker:/repos/gsg_qaart/docker$ docker-compose ps
] Name Command State
Ports
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
callback_framework_1_df361f67842c /bootstrap.sh Up 0.0.0.0:2020->2020/tcp, 0.0.0.0:2025->2025/tcp, 0.0.0.0:4999->4999/tcp, 5432/tcp


As you can see the name is weird, it supposes to be "callback_framwork_1", why there is a random number at the end?



BTW, I'm using:



vagrant@docker:/repos/gsg_qaart/docker$ docker -v
Docker version 18.09.0, build 4d60db4
vagrant@docker:/repos/gsg_qaart/docker$ docker-compose -v
docker-compose version 1.23.1, build b02f1306


Thanks.










share|improve this question























  • what's the output of docker ps?

    – Siyu
    Nov 15 '18 at 20:35











  • e743b462e56c gme/fmk:callback "/bootstrap.sh" 2 minutes ago Up 2 minutes 0.0.0.0:2020->2020/tcp, 0.0.0.0:2025->2025/tcp, 0.0.0.0:4999->4999/tcp, 5432/tcp callback_framework_1_2d34e5dc1703

    – Michael.X
    Nov 15 '18 at 22:13






  • 1





    I am also getting this after I just updated to the latest docker version. It broke my scripts because I can no longer count on the container name being constant

    – deltaskelta
    Nov 16 '18 at 9:18











  • I guess this broke LOADS of scripts (including the ones of my team, of course). No wonder they rolled it back in less than a month.

    – Walter Tross
    Nov 30 '18 at 16:34
















5















I have a docker-compose.yml file as below (a piece of it):



version: '3.5'
services:
framework:
image: ${DOCKER_REGISTRY}/gme/fmk:${COMPOSE_PROJECT_NAME}
build: ./fmk
ports:
- "2020:2020"
- "2025:2025"
- "4999:4999"
volumes:
- ${FOLDER_ENV}/workspace/logs/framework:/var/log/gcti
- ${FOLDER_ENV}/..:/usr/local/genesys/gsg_qaart


what I got is:



vagrant@docker:/repos/gsg_qaart/docker$ docker-compose ps
] Name Command State
Ports
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
callback_framework_1_df361f67842c /bootstrap.sh Up 0.0.0.0:2020->2020/tcp, 0.0.0.0:2025->2025/tcp, 0.0.0.0:4999->4999/tcp, 5432/tcp


As you can see the name is weird, it supposes to be "callback_framwork_1", why there is a random number at the end?



BTW, I'm using:



vagrant@docker:/repos/gsg_qaart/docker$ docker -v
Docker version 18.09.0, build 4d60db4
vagrant@docker:/repos/gsg_qaart/docker$ docker-compose -v
docker-compose version 1.23.1, build b02f1306


Thanks.










share|improve this question























  • what's the output of docker ps?

    – Siyu
    Nov 15 '18 at 20:35











  • e743b462e56c gme/fmk:callback "/bootstrap.sh" 2 minutes ago Up 2 minutes 0.0.0.0:2020->2020/tcp, 0.0.0.0:2025->2025/tcp, 0.0.0.0:4999->4999/tcp, 5432/tcp callback_framework_1_2d34e5dc1703

    – Michael.X
    Nov 15 '18 at 22:13






  • 1





    I am also getting this after I just updated to the latest docker version. It broke my scripts because I can no longer count on the container name being constant

    – deltaskelta
    Nov 16 '18 at 9:18











  • I guess this broke LOADS of scripts (including the ones of my team, of course). No wonder they rolled it back in less than a month.

    – Walter Tross
    Nov 30 '18 at 16:34














5












5








5


1






I have a docker-compose.yml file as below (a piece of it):



version: '3.5'
services:
framework:
image: ${DOCKER_REGISTRY}/gme/fmk:${COMPOSE_PROJECT_NAME}
build: ./fmk
ports:
- "2020:2020"
- "2025:2025"
- "4999:4999"
volumes:
- ${FOLDER_ENV}/workspace/logs/framework:/var/log/gcti
- ${FOLDER_ENV}/..:/usr/local/genesys/gsg_qaart


what I got is:



vagrant@docker:/repos/gsg_qaart/docker$ docker-compose ps
] Name Command State
Ports
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
callback_framework_1_df361f67842c /bootstrap.sh Up 0.0.0.0:2020->2020/tcp, 0.0.0.0:2025->2025/tcp, 0.0.0.0:4999->4999/tcp, 5432/tcp


As you can see the name is weird, it supposes to be "callback_framwork_1", why there is a random number at the end?



BTW, I'm using:



vagrant@docker:/repos/gsg_qaart/docker$ docker -v
Docker version 18.09.0, build 4d60db4
vagrant@docker:/repos/gsg_qaart/docker$ docker-compose -v
docker-compose version 1.23.1, build b02f1306


Thanks.










share|improve this question














I have a docker-compose.yml file as below (a piece of it):



version: '3.5'
services:
framework:
image: ${DOCKER_REGISTRY}/gme/fmk:${COMPOSE_PROJECT_NAME}
build: ./fmk
ports:
- "2020:2020"
- "2025:2025"
- "4999:4999"
volumes:
- ${FOLDER_ENV}/workspace/logs/framework:/var/log/gcti
- ${FOLDER_ENV}/..:/usr/local/genesys/gsg_qaart


what I got is:



vagrant@docker:/repos/gsg_qaart/docker$ docker-compose ps
] Name Command State
Ports
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
callback_framework_1_df361f67842c /bootstrap.sh Up 0.0.0.0:2020->2020/tcp, 0.0.0.0:2025->2025/tcp, 0.0.0.0:4999->4999/tcp, 5432/tcp


As you can see the name is weird, it supposes to be "callback_framwork_1", why there is a random number at the end?



BTW, I'm using:



vagrant@docker:/repos/gsg_qaart/docker$ docker -v
Docker version 18.09.0, build 4d60db4
vagrant@docker:/repos/gsg_qaart/docker$ docker-compose -v
docker-compose version 1.23.1, build b02f1306


Thanks.







docker docker-compose containers






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 '18 at 19:46









Michael.XMichael.X

282




282













  • what's the output of docker ps?

    – Siyu
    Nov 15 '18 at 20:35











  • e743b462e56c gme/fmk:callback "/bootstrap.sh" 2 minutes ago Up 2 minutes 0.0.0.0:2020->2020/tcp, 0.0.0.0:2025->2025/tcp, 0.0.0.0:4999->4999/tcp, 5432/tcp callback_framework_1_2d34e5dc1703

    – Michael.X
    Nov 15 '18 at 22:13






  • 1





    I am also getting this after I just updated to the latest docker version. It broke my scripts because I can no longer count on the container name being constant

    – deltaskelta
    Nov 16 '18 at 9:18











  • I guess this broke LOADS of scripts (including the ones of my team, of course). No wonder they rolled it back in less than a month.

    – Walter Tross
    Nov 30 '18 at 16:34



















  • what's the output of docker ps?

    – Siyu
    Nov 15 '18 at 20:35











  • e743b462e56c gme/fmk:callback "/bootstrap.sh" 2 minutes ago Up 2 minutes 0.0.0.0:2020->2020/tcp, 0.0.0.0:2025->2025/tcp, 0.0.0.0:4999->4999/tcp, 5432/tcp callback_framework_1_2d34e5dc1703

    – Michael.X
    Nov 15 '18 at 22:13






  • 1





    I am also getting this after I just updated to the latest docker version. It broke my scripts because I can no longer count on the container name being constant

    – deltaskelta
    Nov 16 '18 at 9:18











  • I guess this broke LOADS of scripts (including the ones of my team, of course). No wonder they rolled it back in less than a month.

    – Walter Tross
    Nov 30 '18 at 16:34

















what's the output of docker ps?

– Siyu
Nov 15 '18 at 20:35





what's the output of docker ps?

– Siyu
Nov 15 '18 at 20:35













e743b462e56c gme/fmk:callback "/bootstrap.sh" 2 minutes ago Up 2 minutes 0.0.0.0:2020->2020/tcp, 0.0.0.0:2025->2025/tcp, 0.0.0.0:4999->4999/tcp, 5432/tcp callback_framework_1_2d34e5dc1703

– Michael.X
Nov 15 '18 at 22:13





e743b462e56c gme/fmk:callback "/bootstrap.sh" 2 minutes ago Up 2 minutes 0.0.0.0:2020->2020/tcp, 0.0.0.0:2025->2025/tcp, 0.0.0.0:4999->4999/tcp, 5432/tcp callback_framework_1_2d34e5dc1703

– Michael.X
Nov 15 '18 at 22:13




1




1





I am also getting this after I just updated to the latest docker version. It broke my scripts because I can no longer count on the container name being constant

– deltaskelta
Nov 16 '18 at 9:18





I am also getting this after I just updated to the latest docker version. It broke my scripts because I can no longer count on the container name being constant

– deltaskelta
Nov 16 '18 at 9:18













I guess this broke LOADS of scripts (including the ones of my team, of course). No wonder they rolled it back in less than a month.

– Walter Tross
Nov 30 '18 at 16:34





I guess this broke LOADS of scripts (including the ones of my team, of course). No wonder they rolled it back in less than a month.

– Walter Tross
Nov 30 '18 at 16:34












3 Answers
3






active

oldest

votes


















5














EDIT.



This change is reverted in v1.23.2





So there is an important change in the compose v1.23, https://github.com/docker/compose/releases/tag/1.23.0




The default naming scheme for containers created by Compose in this
version has changed from project_service_index to
project_service_index_slug, where slug is a
randomly-generated hexadecimal string. Please make sure to update
scripts relying on the old naming scheme accordingly before upgrading.




Therefore if you want to have a deterministic container name, use



services:
framework:
container_name: framework





share|improve this answer

































    0














    I cannot hardcode container name and I want to be able to run from any directory. So I ended up grepping part of the name:



    docker exec -it $(docker ps --format='{{.Names}}' | grep server) bash





    share|improve this answer































      0














      Note, the other answers/troubleshooting are valid/correct, but I'd like to give some food for thought on working with docker-compose, despite how docker-compose reverted the slug change. There is a good practice that can be highlighted in in making use of docker-compose services.



      My personal thoughts are docker-compose was attempting to pursue a shift in how their tool was being used. I read somethings on github that hinted at that, but that's my opinion after reading some of their developers feedback, specifically from the following github issue on the slugs.



      Making use of docker-compose's internal service mechanisms



      I'm attempting to generalize, since the following examples may not be fully applicable to your setup, but they should be helpful none the less. Since you're already using docker-compose, there is a benefit to using service discovery provided via docker networks and docker-compose over hard-coding access via container names.



      When using docker-compose, services are created that are composed of 1..* containers. In your example, the service framework is created with 1 container callback_framework_1_df361f67842c.



      Accessing a service from within another docker container/code in a docker container



      A service can be used for DNS/networking instead of container names, that is everywhere <protocol>://<host>:<port>/<endpoint> where the container name was used as the <host>, the service name can also be used as the <host> (eg executing ping inside of another container on the docker network):



      ping <service>
      ping framework


      vs



      ping <container-name>
      ping callback_framework_1_df361f67842c


      Both the above pings work. Docker takes care of the networking to the appropriate container, farther when there are multiple containers that compose a service, it takes care of load balancing requests to the containers.



      Accessing your containers via service from the host machine, ie running docker commands from scripts



      Addressing if you have scripts executing from the host machine, you can also make use of docker-compose instead of docker commands as well:



      docker-compose exec <service> sh
      docker-compose exec framework sh


      vs



      docker exec -it <container-name> sh
      docker exec -it callback_framework_1_df361f67842c sh


      docker-exec defaults to the first container, but when there are multiple containers that compose a docker service, a target container can be addressed using the --index=<index> flag. See docker-compose exec documentation for more details.






      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%2f53326899%2fwhy-docker-container-name-has-an-random-number-at-the-end%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        5














        EDIT.



        This change is reverted in v1.23.2





        So there is an important change in the compose v1.23, https://github.com/docker/compose/releases/tag/1.23.0




        The default naming scheme for containers created by Compose in this
        version has changed from project_service_index to
        project_service_index_slug, where slug is a
        randomly-generated hexadecimal string. Please make sure to update
        scripts relying on the old naming scheme accordingly before upgrading.




        Therefore if you want to have a deterministic container name, use



        services:
        framework:
        container_name: framework





        share|improve this answer






























          5














          EDIT.



          This change is reverted in v1.23.2





          So there is an important change in the compose v1.23, https://github.com/docker/compose/releases/tag/1.23.0




          The default naming scheme for containers created by Compose in this
          version has changed from project_service_index to
          project_service_index_slug, where slug is a
          randomly-generated hexadecimal string. Please make sure to update
          scripts relying on the old naming scheme accordingly before upgrading.




          Therefore if you want to have a deterministic container name, use



          services:
          framework:
          container_name: framework





          share|improve this answer




























            5












            5








            5







            EDIT.



            This change is reverted in v1.23.2





            So there is an important change in the compose v1.23, https://github.com/docker/compose/releases/tag/1.23.0




            The default naming scheme for containers created by Compose in this
            version has changed from project_service_index to
            project_service_index_slug, where slug is a
            randomly-generated hexadecimal string. Please make sure to update
            scripts relying on the old naming scheme accordingly before upgrading.




            Therefore if you want to have a deterministic container name, use



            services:
            framework:
            container_name: framework





            share|improve this answer















            EDIT.



            This change is reverted in v1.23.2





            So there is an important change in the compose v1.23, https://github.com/docker/compose/releases/tag/1.23.0




            The default naming scheme for containers created by Compose in this
            version has changed from project_service_index to
            project_service_index_slug, where slug is a
            randomly-generated hexadecimal string. Please make sure to update
            scripts relying on the old naming scheme accordingly before upgrading.




            Therefore if you want to have a deterministic container name, use



            services:
            framework:
            container_name: framework






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 29 '18 at 8:22

























            answered Nov 16 '18 at 9:57









            SiyuSiyu

            3,06411231




            3,06411231

























                0














                I cannot hardcode container name and I want to be able to run from any directory. So I ended up grepping part of the name:



                docker exec -it $(docker ps --format='{{.Names}}' | grep server) bash





                share|improve this answer




























                  0














                  I cannot hardcode container name and I want to be able to run from any directory. So I ended up grepping part of the name:



                  docker exec -it $(docker ps --format='{{.Names}}' | grep server) bash





                  share|improve this answer


























                    0












                    0








                    0







                    I cannot hardcode container name and I want to be able to run from any directory. So I ended up grepping part of the name:



                    docker exec -it $(docker ps --format='{{.Names}}' | grep server) bash





                    share|improve this answer













                    I cannot hardcode container name and I want to be able to run from any directory. So I ended up grepping part of the name:



                    docker exec -it $(docker ps --format='{{.Names}}' | grep server) bash






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 23 '18 at 12:08









                    simnosimno

                    161213




                    161213























                        0














                        Note, the other answers/troubleshooting are valid/correct, but I'd like to give some food for thought on working with docker-compose, despite how docker-compose reverted the slug change. There is a good practice that can be highlighted in in making use of docker-compose services.



                        My personal thoughts are docker-compose was attempting to pursue a shift in how their tool was being used. I read somethings on github that hinted at that, but that's my opinion after reading some of their developers feedback, specifically from the following github issue on the slugs.



                        Making use of docker-compose's internal service mechanisms



                        I'm attempting to generalize, since the following examples may not be fully applicable to your setup, but they should be helpful none the less. Since you're already using docker-compose, there is a benefit to using service discovery provided via docker networks and docker-compose over hard-coding access via container names.



                        When using docker-compose, services are created that are composed of 1..* containers. In your example, the service framework is created with 1 container callback_framework_1_df361f67842c.



                        Accessing a service from within another docker container/code in a docker container



                        A service can be used for DNS/networking instead of container names, that is everywhere <protocol>://<host>:<port>/<endpoint> where the container name was used as the <host>, the service name can also be used as the <host> (eg executing ping inside of another container on the docker network):



                        ping <service>
                        ping framework


                        vs



                        ping <container-name>
                        ping callback_framework_1_df361f67842c


                        Both the above pings work. Docker takes care of the networking to the appropriate container, farther when there are multiple containers that compose a service, it takes care of load balancing requests to the containers.



                        Accessing your containers via service from the host machine, ie running docker commands from scripts



                        Addressing if you have scripts executing from the host machine, you can also make use of docker-compose instead of docker commands as well:



                        docker-compose exec <service> sh
                        docker-compose exec framework sh


                        vs



                        docker exec -it <container-name> sh
                        docker exec -it callback_framework_1_df361f67842c sh


                        docker-exec defaults to the first container, but when there are multiple containers that compose a docker service, a target container can be addressed using the --index=<index> flag. See docker-compose exec documentation for more details.






                        share|improve this answer






























                          0














                          Note, the other answers/troubleshooting are valid/correct, but I'd like to give some food for thought on working with docker-compose, despite how docker-compose reverted the slug change. There is a good practice that can be highlighted in in making use of docker-compose services.



                          My personal thoughts are docker-compose was attempting to pursue a shift in how their tool was being used. I read somethings on github that hinted at that, but that's my opinion after reading some of their developers feedback, specifically from the following github issue on the slugs.



                          Making use of docker-compose's internal service mechanisms



                          I'm attempting to generalize, since the following examples may not be fully applicable to your setup, but they should be helpful none the less. Since you're already using docker-compose, there is a benefit to using service discovery provided via docker networks and docker-compose over hard-coding access via container names.



                          When using docker-compose, services are created that are composed of 1..* containers. In your example, the service framework is created with 1 container callback_framework_1_df361f67842c.



                          Accessing a service from within another docker container/code in a docker container



                          A service can be used for DNS/networking instead of container names, that is everywhere <protocol>://<host>:<port>/<endpoint> where the container name was used as the <host>, the service name can also be used as the <host> (eg executing ping inside of another container on the docker network):



                          ping <service>
                          ping framework


                          vs



                          ping <container-name>
                          ping callback_framework_1_df361f67842c


                          Both the above pings work. Docker takes care of the networking to the appropriate container, farther when there are multiple containers that compose a service, it takes care of load balancing requests to the containers.



                          Accessing your containers via service from the host machine, ie running docker commands from scripts



                          Addressing if you have scripts executing from the host machine, you can also make use of docker-compose instead of docker commands as well:



                          docker-compose exec <service> sh
                          docker-compose exec framework sh


                          vs



                          docker exec -it <container-name> sh
                          docker exec -it callback_framework_1_df361f67842c sh


                          docker-exec defaults to the first container, but when there are multiple containers that compose a docker service, a target container can be addressed using the --index=<index> flag. See docker-compose exec documentation for more details.






                          share|improve this answer




























                            0












                            0








                            0







                            Note, the other answers/troubleshooting are valid/correct, but I'd like to give some food for thought on working with docker-compose, despite how docker-compose reverted the slug change. There is a good practice that can be highlighted in in making use of docker-compose services.



                            My personal thoughts are docker-compose was attempting to pursue a shift in how their tool was being used. I read somethings on github that hinted at that, but that's my opinion after reading some of their developers feedback, specifically from the following github issue on the slugs.



                            Making use of docker-compose's internal service mechanisms



                            I'm attempting to generalize, since the following examples may not be fully applicable to your setup, but they should be helpful none the less. Since you're already using docker-compose, there is a benefit to using service discovery provided via docker networks and docker-compose over hard-coding access via container names.



                            When using docker-compose, services are created that are composed of 1..* containers. In your example, the service framework is created with 1 container callback_framework_1_df361f67842c.



                            Accessing a service from within another docker container/code in a docker container



                            A service can be used for DNS/networking instead of container names, that is everywhere <protocol>://<host>:<port>/<endpoint> where the container name was used as the <host>, the service name can also be used as the <host> (eg executing ping inside of another container on the docker network):



                            ping <service>
                            ping framework


                            vs



                            ping <container-name>
                            ping callback_framework_1_df361f67842c


                            Both the above pings work. Docker takes care of the networking to the appropriate container, farther when there are multiple containers that compose a service, it takes care of load balancing requests to the containers.



                            Accessing your containers via service from the host machine, ie running docker commands from scripts



                            Addressing if you have scripts executing from the host machine, you can also make use of docker-compose instead of docker commands as well:



                            docker-compose exec <service> sh
                            docker-compose exec framework sh


                            vs



                            docker exec -it <container-name> sh
                            docker exec -it callback_framework_1_df361f67842c sh


                            docker-exec defaults to the first container, but when there are multiple containers that compose a docker service, a target container can be addressed using the --index=<index> flag. See docker-compose exec documentation for more details.






                            share|improve this answer















                            Note, the other answers/troubleshooting are valid/correct, but I'd like to give some food for thought on working with docker-compose, despite how docker-compose reverted the slug change. There is a good practice that can be highlighted in in making use of docker-compose services.



                            My personal thoughts are docker-compose was attempting to pursue a shift in how their tool was being used. I read somethings on github that hinted at that, but that's my opinion after reading some of their developers feedback, specifically from the following github issue on the slugs.



                            Making use of docker-compose's internal service mechanisms



                            I'm attempting to generalize, since the following examples may not be fully applicable to your setup, but they should be helpful none the less. Since you're already using docker-compose, there is a benefit to using service discovery provided via docker networks and docker-compose over hard-coding access via container names.



                            When using docker-compose, services are created that are composed of 1..* containers. In your example, the service framework is created with 1 container callback_framework_1_df361f67842c.



                            Accessing a service from within another docker container/code in a docker container



                            A service can be used for DNS/networking instead of container names, that is everywhere <protocol>://<host>:<port>/<endpoint> where the container name was used as the <host>, the service name can also be used as the <host> (eg executing ping inside of another container on the docker network):



                            ping <service>
                            ping framework


                            vs



                            ping <container-name>
                            ping callback_framework_1_df361f67842c


                            Both the above pings work. Docker takes care of the networking to the appropriate container, farther when there are multiple containers that compose a service, it takes care of load balancing requests to the containers.



                            Accessing your containers via service from the host machine, ie running docker commands from scripts



                            Addressing if you have scripts executing from the host machine, you can also make use of docker-compose instead of docker commands as well:



                            docker-compose exec <service> sh
                            docker-compose exec framework sh


                            vs



                            docker exec -it <container-name> sh
                            docker exec -it callback_framework_1_df361f67842c sh


                            docker-exec defaults to the first container, but when there are multiple containers that compose a docker service, a target container can be addressed using the --index=<index> flag. See docker-compose exec documentation for more details.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Dec 17 '18 at 21:23

























                            answered Dec 17 '18 at 21:01









                            Arthur WeborgArthur Weborg

                            5,83052251




                            5,83052251






























                                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%2f53326899%2fwhy-docker-container-name-has-an-random-number-at-the-end%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

                                Xamarin.iOS Cant Deploy on Iphone

                                Glorious Revolution

                                Dulmage-Mendelsohn matrix decomposition in Python