I'm using the below stack to try and install WordPress on an ARM based computer but I keep getting an error in Portainer when I try and deploy the stack.
I'm running:
Docker Version: 5:20.10.17~3-0~debian-bullseye
Portainer version: 2.14.0
I get the following error:
failed to deploy a stack: db
Pulling wordpress
Pulling b84950154c18
Pulling fs layer b1ae07faadba
Pulling fs layer 46428e702eff
Pulling fs layer 0e775e0ed5a0
The list is actually much longer than this, I can paste the whole thing if necessary, but it is a lot of "Pulling fs layer {numbers and letters}"
Here is the stack I'm using:
version: '3.1'
services:
wordpress:
image: wordpress
restart: always
ports:
- 8484:80
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: gibblebreath
WORDPRESS_DB_PASSWORD: chickpea655
WORDPRESS_DB_NAME: wpdb
volumes:
- /srv/dev-disk-by-label-Files/Configs/WordPress:/var/www/html
links:
- db:db
db:
image: yobasystems/alpine-mariadb:latest
restart: always
environment:
MYSQL_DATABASE: wpdb
MYSQL_USER: gibblebreath
MYSQL_PASSWORD: chickpea655
MYSQL_RANDOM_ROOT_PASSWORD: '1'
volumes:
- /srv/dev-disk-by-label-Files/Databases/WordPress/db:/var/lib/mysql
volumes:
wordpress:
db:
I've tried other databse images, including mysql:latest, docker.io/bitnami/mariadb:10.7 and others but the same error occurs each time. I've also restarted both docker and portainer.
Any advice would be hugely appreciated.
Related
I am trying to install wordpress using Docker Desktop and WSL2.
I was able to compose an image creating the following docker-compose.yml file and then running docker-compose up
version: '3.1'
services:
wordpress:
image: wordpress
restart: always
ports:
- 8080:80
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: exampleuser
WORDPRESS_DB_PASSWORD: examplepass
WORDPRESS_DB_NAME: exampledb
volumes:
- wordpress:/var/www/html
db:
image: mysql:5.7
restart: always
environment:
MYSQL_DATABASE: exampledb
MYSQL_USER: exampleuser
MYSQL_PASSWORD: examplepass
MYSQL_RANDOM_ROOT_PASSWORD: '1'
volumes:
- db:/var/lib/mysql
volumes:
wordpress:
db:
(This is taken from the official wordpress image's page on docker hub. I have change the default environment variables for DB_USER, DB_PASSWORD and DB_NAME but they were set equal to MYSQL_USER, MYSQL_PASSWORD and MYSQL_DATABASE respectively.)
Back to Docker Desktop, I ran the container, which seems to work correctly because when I got to localhost:8080 I find Wordpress' first setup process. However, when I plug-in the database name, username, password and host that I used in the file I get the error "Error establishing a database connection".
I tried the following for as Database host, but none worked: localhost, localhost:8080, localhost:80 and db.
Any idea?
I was wondering if there is a way to like to speed up the workflow of installing and working on WP, without download install and configure WP each time.
I'm studying Docker, and i would like to know if is it possible, create a dockerfile that does:
1)install WP and mySQL
2)THEN in some way get the files "installed" in that container available to work on it, with my IDE!
Maybe some sort of reverse volume bind??
Hope everything is clear enough!
Thanks to everyone in advance!!
This docker-compose can do the job
version: '3.1'
services:
wordpress:
image: wordpress
restart: always
ports:
- 8080:80
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: exampleuser
WORDPRESS_DB_PASSWORD: examplepass
WORDPRESS_DB_NAME: exampledb
volumes:
- gwordpress:/var/www/html
db:
image: mysql:5.7
restart: always
environment:
MYSQL_DATABASE: exampledb
MYSQL_USER: exampleuser
MYSQL_PASSWORD: examplepass
MYSQL_RANDOM_ROOT_PASSWORD: '1'
volumes:
- gdb:/var/lib/mysql
volumes:
gwordpress:
gdb:
to start the applications, run
docker-compose up -d
and the app will be available at http://127.0.0.1:8080
You still need to install it for the first time, if you want to avid the first time installation you need to switch to custom docker images.
to share the files with your IDE, just change the volume gwordpress with a local path in your machine
I have a website which i want to containerised i tried following the steps mentioned on this link
i have my files copied to /var/www/html/example.com/src/ and also my docker-compose file looks like this :
version: '2'
services:
example_db:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: ${WP_DB_USER_PASSWORD}
MYSQL_DATABASE: ${WP_DB_NAME}
volumes:
- /var/lib/mysql:/docker-entrypoint-initdb.d/example.sql
container_name: example_db
restart: always
example:
depends_on:
- example_db
image: wordpress:5.0.0-php5.6-apache # we're using the image with php7.1
environment:
WORDPRESS_DB_PASSWORD: ${WP_DB_USER_PASSWORD}
WORDPRESS_DB_NAME: ${WP_DB_NAME}
container_name: example
ports:
- "1512:80"
restart: always
links:
- example_db:mysql
volumes:
- ./src:/var/www/html/docker/example.com/src/
i have my wordpress file in /www/html/docker/example.com/src/ and the db backup inside /src/docker/example.com/data/docker-entrypoint-initdb.d/lbdocker.sql
every time i acces the website it goes to the WordPress setup guide.
this is old but the issue is related to the $table_prefix
Your backup table prefix is different than the destination.
Update your config and it will work.
Fix
I'm trying to set up a simple WordPress build using docker compose. However, when I build it, the volumes appear to be empty.
Here is my docker-compose.yml:
version: '3'
services:
wordpress:
image: wordpress
restart: always
ports:
- 8000:80
volumes:
- ./development:/var/www/html
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: password
depends_on:
- db
networks:
- wordpress-network
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
ports:
- 8080:80
links:
- db:db
db:
image: mariadb:latest
ports:
- 127.0.0.1:3306:3306
command: [
'--default_authentication_plugin=mysql_native_password',
'--character-set-server=utf8mb4',
'--collation-server=utf8mb4_unicode_ci'
]
volumes:
- wp-data:/var/lib/mysql
environment:
MYSQL_DATABASE: wordpress
MYSQL_ROOT_PASSWORD: password
networks:
- wordpress-network
networks:
wordpress-network:
driver: bridge
volumes:
wp-data:
driver: local
Here is my local project structure, with theme stylesheet:
I run docker-compose to build the image:
docker-compose up -d --build
But when I open the build in my browser, it looks like the theme is empty:
This leads me to believe the volume is empty. I'd appreciate any help or insights into this issue, thank you.
In your docker-compose file you say ./wp-data:/var/lib/mysql which is host folder mapping (not volume) but in your docker-compose you define docker named volume called wp-data and if you want to use this volume you have to use it as wp-data:/var/lib/mysql. I would also suggest to remove ${PWD} because it might cause problem in sh
I'm try to setup a docker workspace with Alpine, PHP, Apache, MySQL and Composer.
Currently I'm trying to use the following images:
PHP, Alpine and Composer: https://hub.docker.com/r/petehouston/docker-alpine-php-composer/
Wordpress: https://hub.docker.com/_/wordpress/
I created a docker-compose.yml file to manage this dependencies for me.
docker-compose.yml
version: '2'
services:
db:
image: mysql:5.7
volumes:
- ./db:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
depends_on:
- db
image: wordpress:latest
volumes:
- ./www:/var/www/html
links:
- db
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_PASSWORD: wordpress
alpine:
image: petehouston/docker-alpine-php-composer:latest
links:
- wordpress
So my problem is I'm trying to use the composer of the alpine container to manager my Wordpress in the wordpress container but when i try to use the following command:
docker run --rm -v $(pwd):/www -w /wordpress/var/www/html composer/composer create-project roots/sage your-theme-name 8.5.0
nothing happens, and the alpine container doesn't stay up, after i run compose-docker.up he exits
You can't access to Wordpress container from Alpine container using -w /wordpress/var/www/html.
As far as I understand, image petehouston/docker-alpine-php-composer:latest provides PHP deployment environment. That means you should use this image instead of wordpress image.
Your compose file can be like
version: '2'
services:
db:
image: mysql:5.7
volumes:
- ./db:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
alpine:
image: petehouston/docker-alpine-php-composer:latest
volumes:
- ./www:/home
links:
- db
ports:
- "8000:80"
command: composer require phpunit/phpunit
restart: always
Plz give me feedback. I'm sorry because i can't comment to get more information from you. Should you still get errors, comment here. I'll recheck