Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

I am using Docker for the backend of my mobile app and I need to set communication between my mobile app and docker because I am running docker on my local machine because of testing the API. Postman is working well with my docker but the mobile app is not communicating with my docker as expected. If you could share any sample document or a way I would appreciate it.
docker-compose.yml :
version: '3.4'
services:
nginx:
build: ./nginx
container_name: nginx
links:
- game-alpha
- main-alpha
- main-beta
ports:
- '80:80'
- '443:443'
game-alpha:
build:
context: .
dockerfile: ./Dockerfile.game
container_name: game-alpha
expose:
- '3000'
links:
- redis
env_file:
- .env
volumes:
- ./firebaseConfig.json:/root/firebaseConfig.json
main-alpha:
build:
context: .
dockerfile: ./Dockerfile.knowin
container_name: main-alpha
expose:
- '8000'
env_file:
- .env
volumes:
- ./firebaseConfig.json:/root/firebaseConfig.json
main-beta:
build:
context: .
dockerfile: ./Dockerfile.knowin
container_name: main-beta
expose:
- '8000'
env_file:
- .env
volumes:
- ./firebaseConfig.json:/root/firebaseConfig.json
polling-alpha:
build:
context: .
dockerfile: ./Dockerfile.polling
container_name: polling-alpha
env_file:
- .env
volumes:
- ./firebaseConfig.json:/root/firebaseConfig.json
redis:
image: redis:alpine
container_name: redis
expose:
- '6379'
nginx.conf :
worker_processes auto;
events {
worker_connections 1024;
}
http {
server {
listen 80 default_server;
server_name "";
return 444;
}
server {
server_name game.localhost;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://game_nodes;
proxy_redirect off;
}
}
server {
if ($host = game.localhost) {
return 301 https://$host$request_uri;
}
listen 80;
listen [::]:80;
server_name game.localhost;
return 404;
}
upstream game_nodes {
# enable sticky session
#ip_hash;
server game-alpha:3000;
keepalive 8;
}
server {
server_name localhost;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://main_nodes;
proxy_redirect off;
}
}
server {
if ($host = localhost) {
return 301 https://$host$request_uri;
}
listen 80;
listen [::]:80;
server_name localhost;
return 404;
}
upstream main_nodes {
server main-alpha:8000;
server main-beta:8000;
keepalive 8;
}
}
This is my NetworkModule.kt file from app side :
val NetworkModule = module {
factory {
Moshi.Builder()
.add(KotlinJsonAdapterFactory())
.build()
}
factory {
var URL: String = ""
URL = "localhost"
val authInterceptor = getAuthInterceptor(androidApplication())
val okHttpClient = OkHttpClient().newBuilder()
.connectTimeout(120, TimeUnit.SECONDS)
.readTimeout(60, TimeUnit.SECONDS)
.writeTimeout(60, TimeUnit.SECONDS)
.addInterceptor(HttpLoggingInterceptor())
.addInterceptor(authInterceptor)
.build()
Retrofit.Builder()
.baseUrl(URL)
.client(okHttpClient)
.addConverterFactory(MoshiConverterFactory.create(get<Moshi>()))
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build()
}
// Contains Retrofit Singleton Object Which Will Be Injected In Required Service
single {
get<Retrofit>().create(ApiService::class.java)
}
}
d1dd3d9538cc4d06b53e6d1d338d3f
50ff4e4b3c6c4999a12403b1ecda95
a6309a057c3f4cb38fb2e7feb67236
72e571841e7f4a6881090a2f3e93c0
57a72a98162f46a5a5cd04d9b
Thomas Brocken
11575c6d695643cdb40ad47d0f1aea
tez.saad
keneucker
keneucker
max johnson
max johnson