Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't access my serivce #65

Closed
guzhongren opened this issue Aug 2, 2020 · 6 comments
Closed

can't access my serivce #65

guzhongren opened this issue Aug 2, 2020 · 6 comments

Comments

@guzhongren
Copy link

ENV

❯ docker version
Client: Docker Engine - Community
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:41:33 2020
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.12
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       48a66213fe
  Built:            Mon Jun 22 15:49:27 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683**

docker-compose.yaml

https://github.com/guzhongren/deno-restful-api-with-postgresql-tdd

Question

❯ docker-compose ps
                     Name                                   Command               State               Ports            
-----------------------------------------------------------------------------------------------------------------------
deno-restful-api-with-postgresql-tdd_db_1        docker-entrypoint.sh postgres    Up      0.0.0.0:5432->5432/tcp       
deno-restful-api-with-postgresql-tdd_pgadmin_1   /entrypoint.sh                   Up      443/tcp, 0.0.0.0:9099->80/tcp
deno-restful-api-with-postgresql-tdd_restful_1   deno run --allow-net --all ...   Up      0.0.0.0:9000->8000/tcp ****

when I start my compose, I can access my pgadmin,and postgresq, but I can't access my service written by deno; plz ,help me to find the cause; at the same times, I can request my health API in docker container, /api/v1/health

thx

@hayd
Copy link
Contributor

hayd commented Aug 3, 2020

Should the command be run --allow-net ... (drop the deno prefix).

(This will be fixed with #57 - deno run should also work, I have a version of this on machine but have not yet created a PR...)

@guzhongren
Copy link
Author

Your suggestion doesn't work, I have tried more ways, there's no method to work, wait for your new PR

@hayd
Copy link
Contributor

hayd commented Aug 11, 2020

Please let me know if still an issue in 1.2.3

@hayd hayd closed this as completed Aug 11, 2020
@guzhongren
Copy link
Author

Hi, I still can't access my service out of the container, but can do that in the container,

image

FROM hayd/alpine-deno:1.2.3

# The port that your application listens to.
EXPOSE 1993

WORKDIR /app

COPY deps.ts .
RUN deno cache deps.ts
ENV DB_HOST=host.docker.internal

ADD . .

RUN deno cache ./src/index.ts

CMD ["run", "--allow-net", "--allow-env", "./src/index.ts"]

@hayd
Copy link
Contributor

hayd commented Aug 12, 2020

any thoughts on this @lucacasonato ? I haven't used docker-compose so am a little unsure about this issue.

Hi, I still can't access my service out of the container, but can do that in the container,

Is it something like a different port needs to be exposed?

@tststs
Copy link

tststs commented Mar 11, 2021

if using docker-compose you need to add port mapping for 1993

example:

---
version: "3.2"
services:
  deno:
    container_name: deno
    build:
      dockerfile: deno.Dockerfile
      context: .
    image: hayd/alpine-deno:1.8.0
    restart: unless-stopped
    ports:
      - "1993:1993"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants