Back

Docker to Docker Request

  • 0
  • Self Hosted
Binyamin
18 May, 2023, 15:00

Where you get this error exactly? Can you run these commands:

  • docker ps
  • docker logs appwrite

And share the results?

TL;DR
The user is experiencing issues with making a Docker to Docker request. They clarify that both services are in Docker containers. The user is using DRF to make a request to the Appwrite container using localhost as the hostname. The solution provided is to set the ports to 80 and 443 in the environment file and update the docker-compose.yml file accordingly. The user is asked to share the first part of the docker-compose.yml file and the output of `docker ps` and `docker logs appwrite`.
Dev Back-end
18 May, 2023, 15:01

yes, I run and share.

Dev Back-end
18 May, 2023, 15:06

with the command docker ps, output the following:

Dev Back-end
18 May, 2023, 15:10

and with command docker logs appwrite:

Binyamin
18 May, 2023, 15:11

Everything seems in order Can you share the first part of your docker-compose.yml file the part of traefik?

TypeScript
services:
  traefik:
    image: traefik:2.7
    container_name: appwrite-traefik
    <<: *x-logging
    command:
      - --providers.file.directory=/storage/config
      - --providers.file.watch=true
      - --providers.docker=true
      - --providers.docker.exposedByDefault=false
      - --providers.docker.constraints=Label(`traefik.constraint-label-stack`,`appwrite`)
      - --entrypoints.appwrite_web.address=:80
      - --entrypoints.appwrite_websecure.address=:443
    restart: unless-stopped
    ports:
      - 80:80
      - 443:443
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - appwrite-config:/storage/config:ro
      - appwrite-certificates:/storage/certificates:ro
    depends_on:
      - appwrite
    networks:
      - gateway
      - appwrite
Dev Back-end
18 May, 2023, 15:16

yes: traefik: image: traefik:2.7 container_name: appwrite-traefik <<: *x-logging command: - --providers.file.directory=/storage/config - --providers.file.watch=true - --providers.docker=true - --providers.docker.exposedByDefault=false - --providers.docker.constraints=Label(traefik.constraint-label-stack,appwrite) - --entrypoints.appwrite_web.address=:${APPWRITE_PORT} - --entrypoints.appwrite_websecure.address=:${APPWRITE_ADDRESS} restart: unless-stopped ports: - ${APPWRITE_PORT}:${APPWRITE_PORT} - ${APPWRITE_ADDRESS}:${APPWRITE_ADDRESS} volumes: - /var/run/docker.sock:/var/run/docker.sock - appwrite-config:/storage/config:ro - appwrite-certificates:/storage/certificates:ro depends_on: - appwrite networks: - gateway - appwrite environment: - APPWRITE_PORT - APPWRITE_ADDRESS

appwrite: image: appwrite/appwrite:1.2.1 container_name: appwrite <<: *x-logging restart: unless-stopped networks: - appwrite

Dev Back-end
18 May, 2023, 15:17
Binyamin
18 May, 2023, 15:20

Okay, everything fine, just

  • First it better to point to the latest version of Appwrite 1.3.4
  • Second even if you want to use custom ports you should still leave those fields on the default values as such
TypeScript
      - --entrypoints.appwrite_web.address=:80
      - --entrypoints.appwrite_websecure.address=:443
    restart: unless-stopped
    ports:
      - ${APPWRITE_PORT}:80
      - ${APPWRITE_PORT}:443
Binyamin
18 May, 2023, 15:20

Is this make sense?

Dev Back-end
18 May, 2023, 15:26

Yes, I understand but I have the ports and other credentials in my env file, and that's how I work. For example:

Binyamin
18 May, 2023, 15:29

You can keep those on 88 and 447 but, you'll need to set the rest of the values as 80 and 443 as I did here

Dev Back-end
18 May, 2023, 16:25

ok, thanks

Binyamin
18 May, 2023, 16:25

Lmn if it works

Dev Back-end
18 May, 2023, 16:26

I am going to try

Drake
18 May, 2023, 21:40

Where is this request coming from?

Dev Back-end
23 May, 2023, 19:20

Good afternoon @Steven : is making the django rest framework request to appwrite

Drake
23 May, 2023, 19:33

You're making a request from DRF in one docker container to another docker container and using localhost as the hostname?

Dev Back-end
23 May, 2023, 19:39

I do not understand your question

Drake
23 May, 2023, 19:50

What part?

Dev Back-end
23 May, 2023, 20:01

This question

Drake
23 May, 2023, 20:03

What part of the question?

Dev Back-end
24 May, 2023, 18:33

In response I explain and clarify the following: I have my services in docker and appwrite is also installed in "docker"

Dev Back-end
24 May, 2023, 18:48

?

Drake
24 May, 2023, 19:25

right it sounds like both are in docker containers. so if you're making a request in DRF to localhost, that's going to hit itself, not the other Appwrite container

Drake
24 May, 2023, 19:25

Docker to Docker Request

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more