This is for my local docker development. I have two docker hosts and I'm using traefik's reverse proxy to pull them up in browser. One of the hosts is an api which I need to communicate via https calls. The container I'm trying to connect to has the following params:
version: "3.8"
networks:
local-proxy:
external: true
internal:
external: false
services:
web:
build:
context: ./docker/bin/php
container_name: "app-web"
expose:
- "80"
- "443"
networks:
- internal
- local-proxy
I'm able to connect to it via curl when the call is made via non-ssl (http).
curl http://app-web (200 response)
I need to be able to connect via https, in order to keep everything like it's running in production, however it keeps throwing Failed to connect to app-web port 443: Connection refused
Is it possible at all to connect via 443 port from one container to another?
Note: These containers are never deployed to production. They are just for local dev.
Related
I have two docker containers that share the same network. When I ssh into one of the containers make a http call to the other, I get 200 response: curl -i http://app-web.
I need to be able to call app-web container via https: curl https://app-web, however that returns: Failed to connect to app-web port 443: Connection refused.
This is the docker-compose.yml file for the app-web. What am I missing?
version: "3.8"
networks:
local-proxy:
external: true
internal:
external: false
services:
web:
build:
context: ./docker/bin/php
container_name: app-web"
expose:
- "80"
- "443"
networks:
- internal
- local-proxy
As stated by #David Maze
Your application isn't listening on port 443. Compose expose: does
pretty much nothing at all, and you can delete that section of the
file without changing anything about how the containers work.
You need to make sure that the app-web container is set up and actually listening on port 443.
For example, for Apache, this may mean:
Enabling the necessary modules. I.e. a2enmod headers ssl.
Setting up that domain to be able to handle/receive SSL connections.
Restarting your server to implement the changes.
More to that here. How To Create a Self-Signed SSL Certificate for Apache in Ubuntu 18.04
I'm trying since 2 weeks to make a docker compose that link an api server (strapi) and a Nuxt app (client)
Nuxt make request to the api server to get data. But I don't know how to make them communicate to share data and make request.
I tried a lot of config but don't work.
My docker-compose.yml:
version: "3.9"
services:
client:
image: nuxt-client
networks:
- my-network
environment:
STRAPI_URL: server:4040
depends_on:
- server
server:
image: strapi-server
networks:
- my-network
volumes:
- ./data:/app/.tmp/
networks:
my-network:
driver: bridge
I try my nuxt app to make a request on the server with the port 4040
In environment, nuxt app take STRAPI_URL which is the url of the api (example: http://localhost:4040)
But the request on the network tab is 404
I want to put this docker compose in my nginx proxy manager, and i don't want to make port outside containers.
Any help ? :)
I am trying to link my api with my webapp but is doesn't seem to work.
I have this error
[HPM] Error occurred while trying to proxy request /users/me from
localhost:3000 to http://localhost:8080 (ECONNREFUSED)
(https://nodejs.org/api/errors.html#errors_common_system_errors)
When I try to sign in, it doesn't find the users.
Here is the contents of my docker-compose.yml file
version: '3'
services:
api:
build: ./web3-2019-api
ports:
- "8080:8080"
webapp:
build: ./web3-2019-webapp
ports:
- "3000:3000"
links:
- api
Try to connect via docker host api:8080 instead of localhost.
If you connect via localhost from webapp it expects 8080 to be running in webapp docker, but api is another docker and you should connect via api:8080. Though both are running in same machine they are virtual machines and you should connect via respective docker name within docker network
I am using a symfony app and connecting to a local dynamodb instance in a docker container.
I keep getting AWS HTTP error: cURL error 7: Failed to connect to db port 8889: Connection refused error.
My docker-compose file is simply:
version: '3'
services:
web:
depends_on:
- db
build: .
ports:
- "8000:8000"
db:
image: "amazon/dynamodb-local"
ports:
- "8889:8889"
Honestly, I always get confused by the port mapping, but I don't think that should matter here. I'm trying to connect to http://db:8889. To make things simpler, I executed the following inside my web container:
# curl http://db:8889
curl: (7) Failed to connect to db port 8889: Connection refused
I'm kinda stumped, and I think this is such a simple thing most of the docs skim right over it. (or maybe I do)
The image documentation suggests the DynamoDB server runs on port 8000, so you should access it as http://db:8000. You don't have to publish it on port 8000 or on any port at all, but you need to use the container-side port number to reach it from other containers.
I am new to Docker.
I have an image containing a yii framework. both front and back end are containing yii framework.
here is my docker-compose.yml file:
version: '2'
services:
frontend:
build: ./dockerfile-frontend
container_name: erp2_frontend
links:
- backend
environment:
ENABLE_ENV_FILE: 1
ENABLE_LOCALCONF: 1
API_TOKEN: "4022dfde02359429d905066e557245c760f68f5c"
ports:
- "8080:80"
backend:
build: ./dockerfile-backend
container_name: erp2_backend
environment:
ENABLE_ENV_FILE: 1
Now I want to connect my backend image to the mssql server which is outside the docker network. Now, the server contains the mssql server are connected to the local network of my host container. My host container is ubuntu-linux. How can I connect the backend to the mssql server ? is that possible?
thanks for reply.
I don't see a network configuration in your docker-compose file which means that the default bridge network will be used.
You can go ahead and simply specify the external mssql IP and port and your container would be able to communication with mssql. Although you can't initiate a connection from the outside as you have not exposed and mapped any port in backend service.