RUN dotnet restore is failing on docker-compose - .net-core

I am following Udemy:Microservie.
I have created DockerFile for the WebAPI and added Mongo image as database.
when I run the docker-compose -f .\docker-compose.yml -f .\docker-compose.override.yml up -d command, I am getting the following error:
docker-compose.yml file:
version: '3.4'
services:
catalogdb:
image: mongo
catalog.api:
image: ${DOCKER_REGISTRY-}catalogapi
build:
context: .
dockerfile: Services/Catalog/Catalog.API/Dockerfile
volumes:
mongo_data:
docker-compose.override.yml file:
version: '3.4'
services:
catalogdb:
container_name: catalogdb
restart: always
ports:
- "27017:27017"
volumes:
- mongo_data:/data/db
catalog.api:
container_name: catalog.api
environment:
- ASPNETCORE_ENVIRONMENT=Development
- "DatabaseSettings_ConnectionString=mongodb://catalogdb:27017"
depends_on:
- catalogdb
ports:
- "8000:80"
version: '3.4'
services:
catalogdb:
container_name: catalogdb
restart: always
ports:
- "27017:27017"
volumes:
- mongo_data:/data/db
catalog.api:
container_name: catalog.api
environment:
- ASPNETCORE_ENVIRONMENT=Development
- "DatabaseSettings_ConnectionString=mongodb://catalogdb:27017"
depends_on:
- catalogdb
ports:
- "8000:80"
before posting I have spent some time in stack overflow for resolution and tried
Restarting Docker and VS2022
Connected to Internet when running the command
deleted nuget.config in appdata/Roaming.
Added 'DisabledByDefault' and set to 0 in 'Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS
1.3\Client'
but nothing worked.
Can someone Please help on the above issue.

Related

Problem with using APM in asp.net core application

I'm using asp.net core and docker and the goal is to use Elastic APM, here is my configuration:
Program.cs:
app.UseAllElasticApm(builder.Configuration);
appsettings.json:
"ElasticApm": {
"ServiceName": "Appraisal360APMSerivce",
"LogLevel": "verbose",
"ServerUrl": "http://localhost:8200",
"apm-server-secret-token": "",
"TransactionSampleRate": 1.0
}
docker-compose file:
version: '3.4'
services:
apm-server:
image: docker.elastic.co/apm/apm-server:7.15.2
ports:
- 8200:8200
- 6060:6060
volumes:
- ./apm-server.yml:/usr/share/kibana/config/apm-server.yml
environment:
- output.elasticsearch.hosts=["http://elasticsearch:9200"]
networks:
- elastic
command: >
apm-server -e
-E apm-server.rum.enabled=true
-E apm-server.host=0.0.0.0:8200
-E setup.kibana.host=kibana:5601
cap_drop:
- ALL
cap_add:
- CHOWN
- DAC_OVERRIDE
- SETGID
- SETUID
logging:
driver: 'json-file'
options:
max-size: '200m'
max-file: '50'
elasticsearch:
container_name: elasticsearch
image: elasticsearch:8.5.0
ports:
- 9200:9200
volumes:
- elasticsearch-data:/usr/share/elasticsearch/data
environment:
- discovery.type=single-node
- xpack.security.enabled=true
networks:
- elastic
kibana:
container_name: kibana
image: kibana:8.5.0
volumes:
- ./kibana.yml:/usr/share/kibana/config/kibana.yml
environment:
- XPACK_MONITORING_ENABLED=true
- XPACK_MONITORING_COLLECTION_ENABLED=true
- XPACK_SECURITY_ENABLED=true
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
ports:
- 5601:5601
networks:
- elastic
elastic-agent:
image: docker.elastic.co/beats/elastic-agent:8.5.0
container_name: elastic-agent
restart: always
user: root # note, synthetic browser monitors require this set to `elastic-agent`
environment:
- fleet-server-es=http://localhost:9200
- fleet-server-service-token=*****
- fleet-server-policy=fleet-server-policy
networks:
elastic:
driver: bridge
volumes:
elasticsearch-data:
my container is up and running without error
now the problem is here that fleet server does not find any connection like what u see in the picture:
i would be thankful if there is any help

How to set up Network on Rancher UI for multi workload app

I have deployed several workload containers from dockerhub to Rancher. Now I need them connected through a network. How do I go about this? I have a Load balancer set up. I think a network can be set up through load balancer in the Rancher UI?
Currently I have five workloads under one namespace (webapp-9):
webapp-9-apache
webapp-9-php
webapp-9-mysql
webapp-9-solr
webapp-9-phpmyadmin
Following error occurs when pullin up webapp-9-apache workload in browser:
Proxy Error
Reason: DNS lookup failure for: php
Here is my docker-compose.yml:
version: '3.1'
services:
apache:
build:
context: .
dockerfile: path/to/apache/Dockerfile
image: user:webapp-9-apache
ports:
- 80:80
depends_on:
- mysql
- php
volumes:
- ./http:/path/to/web/
php:
build:
context: .
dockerfile: path/to/php/Dockerfile
image: user:webapp-9-php
volumes:
- ./http:/path/to/folder/
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_RANDOM_ROOT_PASSWORD=${MYSQL_RANDOM_ROOT_PASSWORD}
depends_on:
- mysql
mysql:
build:
context: .
dockerfile: path/to/mysql/Dockerfile
image: user:webapp-9-mysql
command: mysqld --sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
ports:
- 3306:3306
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_RANDOM_ROOT_PASSWORD=${MYSQL_RANDOM_ROOT_PASSWORD}
volumes:
- ./data:/path/to/mysql
- .docker/mysql/config:/path/to/conf.d
solr:
build:
context: .
dockerfile: path/to/Dockerfile
image: user:webapp-9-solr
ports:
- "8983:8983"
volumes:
- ./solr_data:/path/to/solr
command:
- solr-precreate
- gettingstarted
phpmyadmin:
build:
context: .
dockerfile: path/to/phpmyadmin/Dockerfile
image: user:webapp-9-phpmyadmin
ports:
- 8090:80
environment:
- PMA_HOST=mysql
- PMA_PORT=3306
- PMA_USER=${MYSQL_USER}
- PMA_PASSWORD=${MYSQL_PASSWORD}
- UPLOAD_LIMIT=200M
All workloads need to be under the same Namespace (which they already were) and the workloads need to be named according to the services in the docker-composer.yml file.
e.g. drupal-9-spintx-php -> php

Docker nginx container with wordpress uploads folder on volume, can't upload files due to permission denied

I have an nginx container running wordpress (using docker compose) and the uploads folder assigned to a volume:
vipirs-uploads:/usr/share/nginx/html/website/wp-content/uploads
I can't upload files:
Unable to create directory wp-content/uploads/2022/05. Is its parent
directory writable by the server?
So the actual uploads folder doesn't exist on the host machine.
Normally i would simply set the correct permissions but in this case i'm not sure how i would go about this. As a test i tried setting chmod to 777 on the folder inside the container but that didn't work.
My docker-compose.yml:
version: '3.7'
services:
rhino-php:
platform: linux/amd64
build:
context: ./docker
dockerfile: Dockerfile-php7.4
image: rhino-php
container_name: rhino-php
volumes:
- ./Vipirs-Website:/usr/share/nginx/html
ports:
- 9000
networks:
- vipirs-net
rhino-proxy:
platform: linux/amd64
image: nginx:alpine
container_name: rhino-proxy
depends_on:
- vipirs-website
volumes:
- ./docker/nginx/proxy-live.conf:/etc/nginx/nginx.conf
- /usr/local/share/sites/vipirs.com/docker/ssl/live:/usr/local/etc/ssl/certs
ports:
- 80:80
- 443:443
networks:
- vipirs-net
vipirs-website:
platform: linux/amd64
image: nginx
container_name: vipirs-website
depends_on:
- rhino-php
- vipirs-website-database
volumes:
- ./docker/nginx/site-live.conf:/etc/nginx/conf.d/default.conf
- ./Vipirs-Website:/usr/share/nginx/html
- ./Vipirs-Website/logs/wp-debug.log:/usr/share/nginx/html/website/wp-content/debug.log
- vipirs-uploads:/usr/share/nginx/html/website/wp-content/uploads
- /usr/local/share/sites/vipirs.com/docker/ssl/live:/usr/local/etc/ssl/certs
ports:
- 80
- 443
links:
- rhino-php
networks:
- vipirs-net
vipirs-website-database:
platform: linux/amd64
image: mysql:5.7
container_name: vipirs-db
environment:
MYSQL_ROOT_PASSWORD: vipirs
MYSQL_DATABASE: vipirs
MYSQL_USER: vipirs
MYSQL_PASSWORD: vipirs
volumes:
- ./Vipirs-Website/db:/usr/share/db
- vipirs-db:/var/lib/mysql
restart: always
ports:
- 3306
networks:
- vipirs-net
networks:
vipirs-net:
volumes:
vipirs-uploads:
vipirs-db:

How to connect wordpress install and cli docker

I am having great trouble with this, Trying to add wp cli to my wordpress installation with docker-compose but cant get it done as im getting an error when trying to connect the two in docker compose - IM getting an error about duplicate volumes.
Can you see what this is?
version: '3.3'
services:
db:
image: mysql
restart: always
volumes:
- mysql_data:/var/lib/mysql
- ./database/init:/docker-entrypoint-initdb.d/:ro
environment:
- MYSQL_ROOT_PASSWORD=admin
- MYSQL_DATABASE=mydb_assdf
- MYSQL_USER=admin
- MYSQL_PASSWORD=admin
security_opt:
- seccomp:unconfined
wordpress:
image: wordpress
depends_on:
- db
- phpmyadmin
ports:
- '8000:80'
restart: always
volumes:
- ./wordpress:/var/www/html
- wp_data:/var/www/html
environment:
- WORDPRESS_DB_HOST=db:3306
- WORDPRESS_DB_USER=admin
- WORDPRESS_DB_PASSWORD=admin
- WORDPRESS_DB_NAME=mydb_assdf
- WORDPRESS_TABLE_PREFIX=adsf_
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
restart: always
ports:
- '8080:80'
environment:
- PMA_HOST=db
- MYSQL_ROOT_PASSWORD=admin
wpcli:
image: wordpress:cli
restart: always
depends_on:
- wordpress
volumes:
- wp_data:/var/www/html
- ./default/:/var/www/html/wp-content
ports:
- '1111:80'
volumes:
mysql_data:
driver: local
wp_data:
driver: local

How to add wp-cli to docker wordpress?

Is there a way to do this without having to go into the container and install it? Seems kind of weird they wouldn't include this with the Wordpress image. Anyway - Heres what I have at the moment.
How would you do this?
version: '3.3'
services:
db:
image: mysql
restart: always
volumes:
- mysql_data:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=admin
- MYSQL_DATABASE=admin
- MYSQL_USER=admin
- MYSQL_PASSWORD=admin
wordpress:
image: wordpress
depends_on:
- db
ports:
- '1234:80'
restart: always
volumes:
- ./wp-content:/var/www/html/wp-content
environment:
- WORDPRESS_DB_HOST=db:3306
- WORDPRESS_DB_USER=admin
- WORDPRESS_DB_PASSWORD=admin
- WORDPRESS_DB_NAME=admin
- WORDPRESS_TABLE_PREFIX=admin
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
restart: always
ports:
- '8080:80'
environment:
- PMA_HOST=db
- MYSQL_ROOT_PASSWORD=admin
volumes:
mysql_data:
driver: local
You can use one of the images tagged with cli, such as:
image: worpress:cli-php7.4
Find the list of available tags on Docker Hub

Resources