Container command could not be invoked - wordpress

Just encountered this error message while trying to bring up a docker-compose stack on my local machine. I have a Dockerfile which is identical to the official Wordpress image. My docker-compose file looks like this:
wordpress:
image: joystick/wp
ports:
- "8000:80"
links:
- wordpress_db:mysql
environment:
- WORDPRESS_DB_HOST=mysql
- WORDPRESS_DB_NAME=wordpress
- WORDPRESS_DB_USER=admin
- WORDPRESS_DB_PASSWORD=password
wordpress_db:
image: tutum/mysql
environment:
- ON_CREATE_DB=wordpress
- MYSQL_PASS=password
When I change the "image" part at the beginning of this to "wordpress" and use the official image, everything comes up as I'd expect. But when I try to build my own image first, and then use it in this docker-compose file, I get the error message "Container command could not be invoked".
I tried adding a "command" node into the "wordpress" section of this docker-compose, but that did not work.

If you're building from official images, e.g. https://github.com/docker-library/wordpress/tree/master/apache, note the file docker-entrypoint.sh. It must be executable, I set 755 and managed to build the image and run the container.

Related

Running dotnet watch run in docker container breaks Nuget package references

I have a docker-compose file where I start the database and the asp.net server with dotnet watch run like this:
backend:
image: mcr.microsoft.com/dotnet/sdk:6.0
depends_on:
- db
environment:
DB_HOST: db
DB_NAME: db
DB_USERNAME: ${DB_USER}
DB_PASSWORD: ${DB_PW}
ASPNETCORE_ENVIRONMENT: Development
ports:
- 7293:7293
volumes:
- ./:/app
working_dir: /app
command: 'dotnet watch run --urls "http://0.0.0.0:7293"'
As you can see I mount the entire project directory in the container.
Now this runs fine and reloads on changes.
But as soon as the container starts in Visual Studio all the references to Nuget packages get marked red and can't be resolved anymore.
There is a .dockerignore file but I don't think anything in here is really relevant. But here is it anyways:
.dockerignore:
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
I know this has something to do with project restore but nothing I tried helped. --no-restore made it just not run at all with an exception that it couldn't find the reference to one of the packages.
Any ideas how to avoid this?
Ok I figured it out. Mounting Apperently doesn't care about .dockerignore. I have to exclude the obj directory in the mount. So I just mount a empty directory like this.
backend:
...
volumes:
- ./:/app
- /app/obj # <- directory won't be mounted
working_dir: /app
command: 'dotnet watch run --urls "http://0.0.0.0:7293"'

WordPress CSS Not loading

trying to install a fresh WordPress Install using Docker Compose. I'm using AWS EC2 with a ELB
Everything looks fine on logs but once I access to my site I got no css loaded, see the screen :
no css
And the network error :
enter image description here
Here is my docker-compose :
version: "3"
services:
wordpress:
image: conetix/wordpress-with-wp-cli
ports:
- 80:80
restart: always
environment:
- WORDPRESS_DB_HOST=namehostwp
- WORDPRESS_DB_USER=nameuserwp
- WORDPRESS_DB_PASSWORD=passworddbwp
- WORDPRESS_DB_NAME=namedbwp
volumes:
- ./wp_data:/var/www/html
This image is wordpress and wp cli.
Then I run :
docker exec <container id> wp core install --path="/var/www/html" --url="http://nomdomaine" title="Example" --admin_user=supervisor --admin_password=strongpassword --admin_email=info#example.com
Install went well, and in wp-config I got the good dbhost, dbuser, dbpw and dbname
All files seems ok
plugins ok
I dont know what to do.. thx for any help / tips
EDIT : stylesheet url : stylesheet
It looks like you haven't properly configured your domain name and as result the css file can not be loaded. That's what your error ERR_NAME_NOT_RESOLVED means

How to handle multiple schemas in a single migrate with flyway

I'm totally new to Flyway but I'm trying to migrate a number of identical test databases using the docker-compose flyway+mysql arrangement described in https://github.com/flyway/flyway-docker
As far as I can tell, the migrate command can take multiple schemas in its -schemas argument but it only seems to apply the actual SQL migration to the first schema in the list.
For example, when I run the migrate with schemas=test_1,test_2,test_3, flyway creates all three databases but only creates the tables specified in the migration file on the first test_1 database.
Is there a way to apply the SQL migration file to all the schemas in the list?
I'm going to leave this question up in case someone can still answer how multiple schemas is useful if the migration file isn't applied to all databases in the list. But, I was able to handle multiple databases in a docker-compose by overriding the flyway entrypoint and command.
So now my docker-compose service looks like:
services:
flyway:
image: flyway/flyway:6.1.4
volumes:
- ./migrations:/flyway/sql
depends_on:
- db
entrypoint: ["bash"]
command: > -c "/flyway/flyway -url=jdbc:mysql://db -schemas=test1 migrate;
/flyway/flyway -url=jdbc:mysql://db -schemas=test2 migrate"
For me what worked was breaking up my migrations into separate executions in my docker-compose file along with docker-postgresql-multiple-databases as follows:
version: '3.8'
services:
postgres-db:
image: 'postgres:13.3'
environment:
POSTGRES_MULTIPLE_DATABASES: 'customers,addresses'
POSTGRES_USER: 'pocketlaundry'
POSTGRES_PASSWORD: 'iceprism'
volumes:
- ./docker-postgresql-multiple-databases:/docker-entrypoint-initdb.d
expose:
- '5432' # Publishes 5432 to other containers (addresses-flyway, customers-flyway) but NOT to host machine
ports:
- '5432:5432'
addresses-flyway:
image: flyway/flyway:7.12.0
command: -url=jdbc:postgresql://postgres-db:5432/addresses -schemas=public -user=pocketlaundry -password=iceprism -connectRetries=60 migrate
volumes:
- ./sports-ball-project/src/test/resources/db/addresses/migrations:/flyway/sql
depends_on:
- postgres-db
links:
- postgres-db
customers-flyway:
image: flyway/flyway:7.12.0
command: -url=jdbc:postgresql://postgres-db:5432/customers -schemas=public -user=pocketlaundry -password=iceprism -connectRetries=60 migrate
volumes:
- ./sports-ball-project/src/test/resources/db/customers/migrations:/flyway/sql
depends_on:
- postgres-db
links:
- postgres-db

Understanding docker-compose of VS2017 webform application

I'm creating a Webform application that I try to containerize.
I use VS2017, create the default webform app, and add docker support.
If I F5 the application, it's working (hopefully)
The "add docker support" adds many files :
1) a Dockerfile, with
FROM microsoft/aspnet:4.6.2
ARG source
WORKDIR /inetpub/wwwroot
COPY ${source:-obj/Docker/publish} .
I understand it's based on the aspnet:4.6.2 image and that it copy the files from obj/docker/publish to put them in the container.
My problem is that I have no files published on this directory. Of course if I docker build, I have an error (it can't find files in obj/docker/publish). Remember, with F5 it's working.
But there's additionnal files.
2) Docker-compose.yml :
version: '3'
services:
legacywebapp:
image: legacywebapp
build:
context: .\LegacyWebApp
dockerfile: Dockerfile
If I understand well, it creates a legacywebapp services based on the dockerfile. The one that is not working, and still no "obj/docker/publish"
3) docker-compose.override.yml with :
version: '3'
services:
legacywebapp:
ports:
- "80"
networks:
default:
external:
name: nat
Ok, I assume it exposes the port 80 (why not in the first file ? but anyway, for modularity it's better I suppose).
If I try
docker-compose -f .\docker-compose.yml -f .\docker-compose.override.yml build
of course I have an error :
Step 4/4 : COPY ${source:-obj/Docker/publish} .
ERROR: Service 'legacywebapp' failed to build: COPY failed: GetFileAttributesEx \\?\C:\windows\TEMP\docker-builder798755009\obj\Docker\publish: The system cannot find the file specified.
Why is it working when I F5 in visual studio ? Let's look in the build output of VS, I can see the command line :
docker-compose -f "C:\Users\...\docker-compose.yml" -f "C:\Users\...\docker-compose.override.yml" -f "C:\Users\...\obj\Docker\docker-compose.vs.debug.g.yml" -p dockercompose15539612722162891187 up -d --build
So, there's another file, I suppose for debugging :
4) docker-compose.vs.debug.g.yml
version: '3'
services:
legacywebapp:
image: legacywebapp:dev
build:
args:
source: obj/Docker/empty/
volumes:
- C:\Users\...\LegacyWebApp:C:\inetpub\wwwroot
- C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Remote Debugger:C:\remote_debugger:ro
labels:
com.microsoft.visualstudio.debuggee.program: "C:\\app\\bin/LegacyWebApp.dll"
com.microsoft.visualstudio.debuggee.workingdirectory: "C:\\app"
And again, no obj/docker/publish. What is the obj/Docker/empty/ ?
How can I build correctly the image ? For example if I want to publish it in a private repository...

Lucee 5, Nginx, and Docker Compose not finding sample index.cfm file

I have set up a fairly vanilla Dockerfile to start with, just to see if I can get the sample index.cfm to run:
FROM lucee/lucee-nginx:preview
And the related docker-compose.yml file:
web:
build: .
ports:
- "80:80"
When I run this, I get an Nginx 403 Forbidden error. If I change the ports setting to 80:8080, I get a Tomcat 404 Not Found error.
I'm lost as to how to get this working with Docker Compose. How can I debug this, or is there a different way that I can configure Docker Compose to get it running?
The newer builds of Lucee 5 work (release candidates especially), so this problem has since "sorted itself out."
See the section of the lucee-dockerfiles project for Lucee 5 on Tomcat-8-jre with Nginx.

Resources