How can one Docker container call another Docker container

前端 未结 3 901
萌比男神i
萌比男神i 2021-02-05 21:08

I have two Docker containers

  1. A Web API
  2. A Console Application that calls Web API

Now, on my local web api is local host and Console applicat

3条回答
  •  不思量自难忘°
    2021-02-05 21:36

    You can use the link option with docker run:

    Run the API:

    docker run -d --name api api_image
    

    Run the client:

    docker run --link api busybox ping api
    

    You should see that api can be resolved by docker.

    That said, going with docker-compose is still a better option.

提交回复
热议问题