what URL can docker container A use to access another docker container B (same dev machine, different projects)From inside of a Docker container, how do I connect to the localhost of the machine?Development workflow for docker-compose: run a dev-version containerProviding a stable url to access a docker container from another docker containerDocker 1.10 access a container by it's hostname from a host machineAccess docker container from host using containers nameDocker inter container communication not workingIdentical Docker images with different containers and ports not accessibleCan't access docker container from host (osx)Docker gitlab container heatly but not accessiblehow can I communicate between containers?

Names of the Six Tastes

Do these creatures from the Tomb of Annihilation campaign speak Common?

How to explain intravenous drug abuse to a 6-year-old?

Is it possible to do moon sighting in advance for 5 years with 100% accuracy?

Why did Yoast put a no-index tag in my XML sitemap?

Why are thrust reversers not used down to taxi speeds?

Whose birthyears are canonically established in the MCU?

What's the difference between "ricochet" and "bounce"?

Was Mohammed the most popular first name for boys born in Berlin in 2018?

get unsigned long long addition carry

Partition error (Fdisk/Parted)

Flooding vs Unknown Unicast Flooding

What will Doctor Strange protect now?

Are wands in any sort of book going to be too much like Harry Potter?

How can I test a shell script in a "safe environment" to avoid harm to my computer?

Is your maximum jump distance halved by grappling?

Does this website provide consistent translation into Wookiee?

Capturing the entire webpage with WebExecute's CaptureImage

Company stopped my paying salary. What are my options?

When was it publicly revealed that a KH-11 spy satellite took pictures of the first Shuttle flight?

Are there vaccine ingredients which may not be disclosed ("hidden", "trade secret", or similar)?

Where do 5 or more U.S. counties meet in a single point?

Visual Studio Code download existing code

Why doesn't increasing the temperature of something like wood or paper set them on fire?



what URL can docker container A use to access another docker container B (same dev machine, different projects)


From inside of a Docker container, how do I connect to the localhost of the machine?Development workflow for docker-compose: run a dev-version containerProviding a stable url to access a docker container from another docker containerDocker 1.10 access a container by it's hostname from a host machineAccess docker container from host using containers nameDocker inter container communication not workingIdentical Docker images with different containers and ports not accessibleCan't access docker container from host (osx)Docker gitlab container heatly but not accessiblehow can I communicate between containers?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















Assuming we need to do this very rarely only at certain stages of development (to smoke test a few api calls), what is the simplest possible way to let a dockerized web service in project Bar access a dockerized web service in Project Foo?



On a development Mac, Docker Engine: 18.09.2, Compose: 1.23.2, we have Project Foo and Project Bar which each have their own docker-compose files, each with a web service and a database service.



Normally they run stand-alone, and are developed independently.



However Project Foo's web service hosts an API that only occasionally we want to access from Project Bar's web container



They are assigned to different host ports, docker ps shows Project Foo uses port 0.0.0.0:3000->3000/tcp (eg, we use localhost:3000 to access the web service from the Mac's browser. Project Bar uses port 0.0.0.0:3010->3010/tcp



docker inspect for Foo shows it's IP address is "172.18.0.3" (gateway "172.18.0.1") and for Bar shows it's IP address is "172.22.0.4" (gateway "172.22.0.1")



docker network ls shows they are both using the same "bridge" Driver.



Both projects are running on the Mac, 4 containers total, (web+db on Foo, and web+db on Bar)



If a program (Ruby) running on Bar needs to access a REST URL on Foo, what is the URL of "/api_test" on Foo?



From the Bar web container I've tried http://localhost:3000/api_test and http://127.0.0.1:3000/api_test (which is what we'd use from a web browser so didn't really expect that to work from container-to-container) and I've tried http://172.18.0.3:3000/api_test and http://172.18.0.3/api_test neither of which worked.



I see online references to setting up a link or a docker network, but all of the examples are for when using docker run instead of using docker-compose. I would expect that if you know the IP and port of each container's web server, it ought to be a matter of using the correct URL without any extra network setup?



Any help would be appreciated.



A manually-assigned static IP solution is preferred... Before Docker, we used Vagrant and that was simple, in each project's Vagrantfile we simply manually assigned them an IP on the same private subnet 192.168.50.50 and 192.168.50.51 and they "talked" to each other just fine, and we could simply 'code' those IPs into our development code. Docker seems to have an additional layer of abstraction that has me puzzled.










share|improve this question






























    0















    Assuming we need to do this very rarely only at certain stages of development (to smoke test a few api calls), what is the simplest possible way to let a dockerized web service in project Bar access a dockerized web service in Project Foo?



    On a development Mac, Docker Engine: 18.09.2, Compose: 1.23.2, we have Project Foo and Project Bar which each have their own docker-compose files, each with a web service and a database service.



    Normally they run stand-alone, and are developed independently.



    However Project Foo's web service hosts an API that only occasionally we want to access from Project Bar's web container



    They are assigned to different host ports, docker ps shows Project Foo uses port 0.0.0.0:3000->3000/tcp (eg, we use localhost:3000 to access the web service from the Mac's browser. Project Bar uses port 0.0.0.0:3010->3010/tcp



    docker inspect for Foo shows it's IP address is "172.18.0.3" (gateway "172.18.0.1") and for Bar shows it's IP address is "172.22.0.4" (gateway "172.22.0.1")



    docker network ls shows they are both using the same "bridge" Driver.



    Both projects are running on the Mac, 4 containers total, (web+db on Foo, and web+db on Bar)



    If a program (Ruby) running on Bar needs to access a REST URL on Foo, what is the URL of "/api_test" on Foo?



    From the Bar web container I've tried http://localhost:3000/api_test and http://127.0.0.1:3000/api_test (which is what we'd use from a web browser so didn't really expect that to work from container-to-container) and I've tried http://172.18.0.3:3000/api_test and http://172.18.0.3/api_test neither of which worked.



    I see online references to setting up a link or a docker network, but all of the examples are for when using docker run instead of using docker-compose. I would expect that if you know the IP and port of each container's web server, it ought to be a matter of using the correct URL without any extra network setup?



    Any help would be appreciated.



    A manually-assigned static IP solution is preferred... Before Docker, we used Vagrant and that was simple, in each project's Vagrantfile we simply manually assigned them an IP on the same private subnet 192.168.50.50 and 192.168.50.51 and they "talked" to each other just fine, and we could simply 'code' those IPs into our development code. Docker seems to have an additional layer of abstraction that has me puzzled.










    share|improve this question


























      0












      0








      0








      Assuming we need to do this very rarely only at certain stages of development (to smoke test a few api calls), what is the simplest possible way to let a dockerized web service in project Bar access a dockerized web service in Project Foo?



      On a development Mac, Docker Engine: 18.09.2, Compose: 1.23.2, we have Project Foo and Project Bar which each have their own docker-compose files, each with a web service and a database service.



      Normally they run stand-alone, and are developed independently.



      However Project Foo's web service hosts an API that only occasionally we want to access from Project Bar's web container



      They are assigned to different host ports, docker ps shows Project Foo uses port 0.0.0.0:3000->3000/tcp (eg, we use localhost:3000 to access the web service from the Mac's browser. Project Bar uses port 0.0.0.0:3010->3010/tcp



      docker inspect for Foo shows it's IP address is "172.18.0.3" (gateway "172.18.0.1") and for Bar shows it's IP address is "172.22.0.4" (gateway "172.22.0.1")



      docker network ls shows they are both using the same "bridge" Driver.



      Both projects are running on the Mac, 4 containers total, (web+db on Foo, and web+db on Bar)



      If a program (Ruby) running on Bar needs to access a REST URL on Foo, what is the URL of "/api_test" on Foo?



      From the Bar web container I've tried http://localhost:3000/api_test and http://127.0.0.1:3000/api_test (which is what we'd use from a web browser so didn't really expect that to work from container-to-container) and I've tried http://172.18.0.3:3000/api_test and http://172.18.0.3/api_test neither of which worked.



      I see online references to setting up a link or a docker network, but all of the examples are for when using docker run instead of using docker-compose. I would expect that if you know the IP and port of each container's web server, it ought to be a matter of using the correct URL without any extra network setup?



      Any help would be appreciated.



      A manually-assigned static IP solution is preferred... Before Docker, we used Vagrant and that was simple, in each project's Vagrantfile we simply manually assigned them an IP on the same private subnet 192.168.50.50 and 192.168.50.51 and they "talked" to each other just fine, and we could simply 'code' those IPs into our development code. Docker seems to have an additional layer of abstraction that has me puzzled.










      share|improve this question
















      Assuming we need to do this very rarely only at certain stages of development (to smoke test a few api calls), what is the simplest possible way to let a dockerized web service in project Bar access a dockerized web service in Project Foo?



      On a development Mac, Docker Engine: 18.09.2, Compose: 1.23.2, we have Project Foo and Project Bar which each have their own docker-compose files, each with a web service and a database service.



      Normally they run stand-alone, and are developed independently.



      However Project Foo's web service hosts an API that only occasionally we want to access from Project Bar's web container



      They are assigned to different host ports, docker ps shows Project Foo uses port 0.0.0.0:3000->3000/tcp (eg, we use localhost:3000 to access the web service from the Mac's browser. Project Bar uses port 0.0.0.0:3010->3010/tcp



      docker inspect for Foo shows it's IP address is "172.18.0.3" (gateway "172.18.0.1") and for Bar shows it's IP address is "172.22.0.4" (gateway "172.22.0.1")



      docker network ls shows they are both using the same "bridge" Driver.



      Both projects are running on the Mac, 4 containers total, (web+db on Foo, and web+db on Bar)



      If a program (Ruby) running on Bar needs to access a REST URL on Foo, what is the URL of "/api_test" on Foo?



      From the Bar web container I've tried http://localhost:3000/api_test and http://127.0.0.1:3000/api_test (which is what we'd use from a web browser so didn't really expect that to work from container-to-container) and I've tried http://172.18.0.3:3000/api_test and http://172.18.0.3/api_test neither of which worked.



      I see online references to setting up a link or a docker network, but all of the examples are for when using docker run instead of using docker-compose. I would expect that if you know the IP and port of each container's web server, it ought to be a matter of using the correct URL without any extra network setup?



      Any help would be appreciated.



      A manually-assigned static IP solution is preferred... Before Docker, we used Vagrant and that was simple, in each project's Vagrantfile we simply manually assigned them an IP on the same private subnet 192.168.50.50 and 192.168.50.51 and they "talked" to each other just fine, and we could simply 'code' those IPs into our development code. Docker seems to have an additional layer of abstraction that has me puzzled.







      docker-compose docker-networking






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 23 at 16:04







      jpwynn

















      asked Mar 23 at 7:06









      jpwynnjpwynn

      9,0482191148




      9,0482191148






















          2 Answers
          2






          active

          oldest

          votes


















          0














          I finally found a SO thread that mentioned for newer versions of Docker such as I am using the hostname host.docker.internal accesses the host machine, so one answer to my question is - since I already have assigned different ports to Foo and Bar - the Bar container can use the url http://host.docker.internal:3000/api_test



          But it is still preferred to be able to assign static IPs to each container so I am leaving the question open.






          share|improve this answer






























            0














            You can use docker network for access container A to B. https://docs.docker.com/network/



            Use docker network --help.




            1. Create a network



              • docker network create mynetwork



            2. Put the containers both containerA and containerB in this network which is mynetwork in this case.



              • docker network connect mynetwork containerA


              • docker network connect mynetwork containerB



            3. You can access one container to another container with container name now.


            Also you can test it with ping. Go A or B container bash and use;



            1. apt-get update


            2. apt-get install iputils-ping


            3. Test it like if you in containerA use ping containerB.


            For example-1:



            If you want to use it in apache virtualhost settings with port;



            • ProxyPass "/" "http://containerB:3000"

            For example-2:



            I have two container; base and myphp named. I'm running nodejs app in base container on port 3000. And I'm running apache and php on second container myphp.



            Basicly my nodejs app gives me a "Hello Word" output. It's working on container base Here is the code:



            'use strict';

            const express = require('express');

            // Constants
            const PORT = 3000;
            const HOST = '0.0.0.0';

            // App
            const app = express();
            app.get('/', (req, res) =>
            res.send('Hello worldn');
            );

            app.listen(PORT, HOST);
            console.log(`Running on http://$HOST:$PORT`);


            Basicly my php app gives me all source code the connected address. It's working on container myphp. Here is the code:



            <?php
            $domain = 'http://base:3000';
            $handle = fopen($domain, 'r');
            $content = stream_get_contents($handle);
            fclose($handle);

            echo "<textarea rows='20' cols='80'>$content</textarea>";
            ?>


            Then i put these two container the same network. And when i run this index.php which is myphp container app. It gives me "Hello Word";



            So if you put containers the same network you can access each other with its name like "http://containerB:3000" or if your router listening "/api_test" "http://containerB:3000/api_test".



            Finally this is what i am doing communicate containers. I hope it works for you too.






            share|improve this answer

























            • Thank you, looks interesting... but can you add to your answer what URL would container A use to access the web app in container B?

              – jpwynn
              Mar 23 at 18:58











            • I edit my answer and add second example i hope it's clear and work for you.

              – Utku Altaş
              Mar 23 at 19:57












            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%2f55311465%2fwhat-url-can-docker-container-a-use-to-access-another-docker-container-b-same-d%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I finally found a SO thread that mentioned for newer versions of Docker such as I am using the hostname host.docker.internal accesses the host machine, so one answer to my question is - since I already have assigned different ports to Foo and Bar - the Bar container can use the url http://host.docker.internal:3000/api_test



            But it is still preferred to be able to assign static IPs to each container so I am leaving the question open.






            share|improve this answer



























              0














              I finally found a SO thread that mentioned for newer versions of Docker such as I am using the hostname host.docker.internal accesses the host machine, so one answer to my question is - since I already have assigned different ports to Foo and Bar - the Bar container can use the url http://host.docker.internal:3000/api_test



              But it is still preferred to be able to assign static IPs to each container so I am leaving the question open.






              share|improve this answer

























                0












                0








                0







                I finally found a SO thread that mentioned for newer versions of Docker such as I am using the hostname host.docker.internal accesses the host machine, so one answer to my question is - since I already have assigned different ports to Foo and Bar - the Bar container can use the url http://host.docker.internal:3000/api_test



                But it is still preferred to be able to assign static IPs to each container so I am leaving the question open.






                share|improve this answer













                I finally found a SO thread that mentioned for newer versions of Docker such as I am using the hostname host.docker.internal accesses the host machine, so one answer to my question is - since I already have assigned different ports to Foo and Bar - the Bar container can use the url http://host.docker.internal:3000/api_test



                But it is still preferred to be able to assign static IPs to each container so I am leaving the question open.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 23 at 17:37









                jpwynnjpwynn

                9,0482191148




                9,0482191148























                    0














                    You can use docker network for access container A to B. https://docs.docker.com/network/



                    Use docker network --help.




                    1. Create a network



                      • docker network create mynetwork



                    2. Put the containers both containerA and containerB in this network which is mynetwork in this case.



                      • docker network connect mynetwork containerA


                      • docker network connect mynetwork containerB



                    3. You can access one container to another container with container name now.


                    Also you can test it with ping. Go A or B container bash and use;



                    1. apt-get update


                    2. apt-get install iputils-ping


                    3. Test it like if you in containerA use ping containerB.


                    For example-1:



                    If you want to use it in apache virtualhost settings with port;



                    • ProxyPass "/" "http://containerB:3000"

                    For example-2:



                    I have two container; base and myphp named. I'm running nodejs app in base container on port 3000. And I'm running apache and php on second container myphp.



                    Basicly my nodejs app gives me a "Hello Word" output. It's working on container base Here is the code:



                    'use strict';

                    const express = require('express');

                    // Constants
                    const PORT = 3000;
                    const HOST = '0.0.0.0';

                    // App
                    const app = express();
                    app.get('/', (req, res) =>
                    res.send('Hello worldn');
                    );

                    app.listen(PORT, HOST);
                    console.log(`Running on http://$HOST:$PORT`);


                    Basicly my php app gives me all source code the connected address. It's working on container myphp. Here is the code:



                    <?php
                    $domain = 'http://base:3000';
                    $handle = fopen($domain, 'r');
                    $content = stream_get_contents($handle);
                    fclose($handle);

                    echo "<textarea rows='20' cols='80'>$content</textarea>";
                    ?>


                    Then i put these two container the same network. And when i run this index.php which is myphp container app. It gives me "Hello Word";



                    So if you put containers the same network you can access each other with its name like "http://containerB:3000" or if your router listening "/api_test" "http://containerB:3000/api_test".



                    Finally this is what i am doing communicate containers. I hope it works for you too.






                    share|improve this answer

























                    • Thank you, looks interesting... but can you add to your answer what URL would container A use to access the web app in container B?

                      – jpwynn
                      Mar 23 at 18:58











                    • I edit my answer and add second example i hope it's clear and work for you.

                      – Utku Altaş
                      Mar 23 at 19:57
















                    0














                    You can use docker network for access container A to B. https://docs.docker.com/network/



                    Use docker network --help.




                    1. Create a network



                      • docker network create mynetwork



                    2. Put the containers both containerA and containerB in this network which is mynetwork in this case.



                      • docker network connect mynetwork containerA


                      • docker network connect mynetwork containerB



                    3. You can access one container to another container with container name now.


                    Also you can test it with ping. Go A or B container bash and use;



                    1. apt-get update


                    2. apt-get install iputils-ping


                    3. Test it like if you in containerA use ping containerB.


                    For example-1:



                    If you want to use it in apache virtualhost settings with port;



                    • ProxyPass "/" "http://containerB:3000"

                    For example-2:



                    I have two container; base and myphp named. I'm running nodejs app in base container on port 3000. And I'm running apache and php on second container myphp.



                    Basicly my nodejs app gives me a "Hello Word" output. It's working on container base Here is the code:



                    'use strict';

                    const express = require('express');

                    // Constants
                    const PORT = 3000;
                    const HOST = '0.0.0.0';

                    // App
                    const app = express();
                    app.get('/', (req, res) =>
                    res.send('Hello worldn');
                    );

                    app.listen(PORT, HOST);
                    console.log(`Running on http://$HOST:$PORT`);


                    Basicly my php app gives me all source code the connected address. It's working on container myphp. Here is the code:



                    <?php
                    $domain = 'http://base:3000';
                    $handle = fopen($domain, 'r');
                    $content = stream_get_contents($handle);
                    fclose($handle);

                    echo "<textarea rows='20' cols='80'>$content</textarea>";
                    ?>


                    Then i put these two container the same network. And when i run this index.php which is myphp container app. It gives me "Hello Word";



                    So if you put containers the same network you can access each other with its name like "http://containerB:3000" or if your router listening "/api_test" "http://containerB:3000/api_test".



                    Finally this is what i am doing communicate containers. I hope it works for you too.






                    share|improve this answer

























                    • Thank you, looks interesting... but can you add to your answer what URL would container A use to access the web app in container B?

                      – jpwynn
                      Mar 23 at 18:58











                    • I edit my answer and add second example i hope it's clear and work for you.

                      – Utku Altaş
                      Mar 23 at 19:57














                    0












                    0








                    0







                    You can use docker network for access container A to B. https://docs.docker.com/network/



                    Use docker network --help.




                    1. Create a network



                      • docker network create mynetwork



                    2. Put the containers both containerA and containerB in this network which is mynetwork in this case.



                      • docker network connect mynetwork containerA


                      • docker network connect mynetwork containerB



                    3. You can access one container to another container with container name now.


                    Also you can test it with ping. Go A or B container bash and use;



                    1. apt-get update


                    2. apt-get install iputils-ping


                    3. Test it like if you in containerA use ping containerB.


                    For example-1:



                    If you want to use it in apache virtualhost settings with port;



                    • ProxyPass "/" "http://containerB:3000"

                    For example-2:



                    I have two container; base and myphp named. I'm running nodejs app in base container on port 3000. And I'm running apache and php on second container myphp.



                    Basicly my nodejs app gives me a "Hello Word" output. It's working on container base Here is the code:



                    'use strict';

                    const express = require('express');

                    // Constants
                    const PORT = 3000;
                    const HOST = '0.0.0.0';

                    // App
                    const app = express();
                    app.get('/', (req, res) =>
                    res.send('Hello worldn');
                    );

                    app.listen(PORT, HOST);
                    console.log(`Running on http://$HOST:$PORT`);


                    Basicly my php app gives me all source code the connected address. It's working on container myphp. Here is the code:



                    <?php
                    $domain = 'http://base:3000';
                    $handle = fopen($domain, 'r');
                    $content = stream_get_contents($handle);
                    fclose($handle);

                    echo "<textarea rows='20' cols='80'>$content</textarea>";
                    ?>


                    Then i put these two container the same network. And when i run this index.php which is myphp container app. It gives me "Hello Word";



                    So if you put containers the same network you can access each other with its name like "http://containerB:3000" or if your router listening "/api_test" "http://containerB:3000/api_test".



                    Finally this is what i am doing communicate containers. I hope it works for you too.






                    share|improve this answer















                    You can use docker network for access container A to B. https://docs.docker.com/network/



                    Use docker network --help.




                    1. Create a network



                      • docker network create mynetwork



                    2. Put the containers both containerA and containerB in this network which is mynetwork in this case.



                      • docker network connect mynetwork containerA


                      • docker network connect mynetwork containerB



                    3. You can access one container to another container with container name now.


                    Also you can test it with ping. Go A or B container bash and use;



                    1. apt-get update


                    2. apt-get install iputils-ping


                    3. Test it like if you in containerA use ping containerB.


                    For example-1:



                    If you want to use it in apache virtualhost settings with port;



                    • ProxyPass "/" "http://containerB:3000"

                    For example-2:



                    I have two container; base and myphp named. I'm running nodejs app in base container on port 3000. And I'm running apache and php on second container myphp.



                    Basicly my nodejs app gives me a "Hello Word" output. It's working on container base Here is the code:



                    'use strict';

                    const express = require('express');

                    // Constants
                    const PORT = 3000;
                    const HOST = '0.0.0.0';

                    // App
                    const app = express();
                    app.get('/', (req, res) =>
                    res.send('Hello worldn');
                    );

                    app.listen(PORT, HOST);
                    console.log(`Running on http://$HOST:$PORT`);


                    Basicly my php app gives me all source code the connected address. It's working on container myphp. Here is the code:



                    <?php
                    $domain = 'http://base:3000';
                    $handle = fopen($domain, 'r');
                    $content = stream_get_contents($handle);
                    fclose($handle);

                    echo "<textarea rows='20' cols='80'>$content</textarea>";
                    ?>


                    Then i put these two container the same network. And when i run this index.php which is myphp container app. It gives me "Hello Word";



                    So if you put containers the same network you can access each other with its name like "http://containerB:3000" or if your router listening "/api_test" "http://containerB:3000/api_test".



                    Finally this is what i am doing communicate containers. I hope it works for you too.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Mar 23 at 19:52

























                    answered Mar 23 at 17:56









                    Utku AltaşUtku Altaş

                    183




                    183












                    • Thank you, looks interesting... but can you add to your answer what URL would container A use to access the web app in container B?

                      – jpwynn
                      Mar 23 at 18:58











                    • I edit my answer and add second example i hope it's clear and work for you.

                      – Utku Altaş
                      Mar 23 at 19:57


















                    • Thank you, looks interesting... but can you add to your answer what URL would container A use to access the web app in container B?

                      – jpwynn
                      Mar 23 at 18:58











                    • I edit my answer and add second example i hope it's clear and work for you.

                      – Utku Altaş
                      Mar 23 at 19:57

















                    Thank you, looks interesting... but can you add to your answer what URL would container A use to access the web app in container B?

                    – jpwynn
                    Mar 23 at 18:58





                    Thank you, looks interesting... but can you add to your answer what URL would container A use to access the web app in container B?

                    – jpwynn
                    Mar 23 at 18:58













                    I edit my answer and add second example i hope it's clear and work for you.

                    – Utku Altaş
                    Mar 23 at 19:57






                    I edit my answer and add second example i hope it's clear and work for you.

                    – Utku Altaş
                    Mar 23 at 19:57


















                    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%2f55311465%2fwhat-url-can-docker-container-a-use-to-access-another-docker-container-b-same-d%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

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해