Azerothcore - Docker .env MySQL-Password not working - docker

This was orginally asked via this github issue:
https://github.com/azerothcore/azerothcore-wotlk/issues/3527
When copying the ./.env.dist file to ./.env and changing the password for the mysql database the password is still set to "password" after the containers are up and running.
Per the docker install guide here:
https://www.azerothcore.org/wiki/Install-with-Docker
Doing this should change the mysql database password.
I have tried the following:
docker rm $(docker ps -aq)
docker rmi $(docker images -q)
docker system prune
but still no luck. I've tried it with an older version of the repo from my backup and there it is working.

There is a persistent volume for the ac-database docker. here is what I would try:
docker-compose stop
docker-compose down
docker system prune
docker system prune --volumes

Related

Docker system prune: only current directory

I'm working on 2 projects that both use Docker, in separate directories.
In the 2nd project, for a new local build, the first command given (of a series of commands) is the following:
docker container stop $(docker container ls -a -q) && docker system prune -a -f --volumes
However, as a side effect, this kills the containers in the 1st project, also destroying the databases associated with it as well.
This is annoying because I have to constantly rebuild and re-seed the database in the 1st project.
How can I edit the first command such that it only effects the project in the current directory?
Note that this project is also using docker-compose, which I know is good at noting the current directory, so maybe we could make use of docker-compose instead.
The full list of commands given for a new local build are:
docker container stop $(docker container ls -a -q) && docker system prune -a -f --volumes
docker stack rm up
docker-compose -f docker-compose.local.yml build
docker stack deploy up --compose-file docker-compose.local.yml
Thank you very much in advance for any help.
-Michael

reset a docker container to its initial state every 24 hours

I need to reset a moodle docker to its initial state every 24 hours. This docker will be a running a demo site where users can login and carry out various setting changes and the site needs to reset itself every day. Does docker provide any such feature?
I searched for a docker reset command but it doesn't seem to be there yet.
Will such a process of removing and reinitiating docker container work?
docker rm -f $(docker ps -a -q)
docker volume rm $(docker volume ls -q)
docker-compose up -d
I should be able to do this programatically ofcourse, preferably using a shell script.
Yes you do not need to reset just recreate the container is enough but if you bind volumes with the host it will not work if there is anything that pick from persistent storage of the host in docker-compose up.
Write a bash script that will run every 1:00 AM or whatever time you want to create fresh container.
0 0 * * * create_container.sh
create_container.sh
#!/bin/bash
docker-compose rm -f
docker-compose up -d
or you can use your own script as well but if there is bind volumes the clear that files before creating the container.
rm -rf /path/to_host_shared_volume
docker rm -f $(docker ps -a -q)
.
.
.
As the behavour of -v is different it will create directory if not exist.
Or if you want to remove everything then you can use system-prune
#!/bin/bash
docker system prune -f -a --volumes
docker-compose up -d
Remove all unused containers, networks, images (both dangling and unreferenced), and volumes.
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all volumes not used by at least one container
- all images without at least one container associated to them
- all build cache

Docker Compose Could not open file build: No such file or directory

After moving my docker project on my disc I can no longer run it. Whenever I try to run docker-compose build or docker-compose up I get an error
Could not open file build: No such file or directory
I've tried purging all docker resources but am still receiving this error.
docker kill $(docker ps -q)
docker rm $(docker ps -a -q)
docker rmi $(docker images -q -f dangling=true)
docker rmi $(docker images -q)
How can I either purge all docker data entirely, or fix the issue after moving my project?
My docker-compose.yml is unedited from this project's dc file.
You can prune all docker data on the system by using the command docker system prune.

How to setup docker-machine to be as default?

I want to rebuild everything from my docker VM named default, I used docker-compose down but it only removed the containers, all the requirements are still installed and I would like it to be as it was from the beginning so I can 're'-setup everything. Is it possible ?
This will remove all containers, images and volumes
docker rm -f $(docker ps -aq)
docker image rm $(docker image ls -q)
docker volume rm $(docker volume ls -q)
There are other things like networks and secrets that will not be removed, but they should not cause any problems.
If you are using a newer version of docker try the docker system prune -a command instead.
But maybe the --no-cache argumant ist the real solution for your problem. With it, docker will not use the cache and will do a full rebuild of the image.
The simple solution that will ignore previous builds:
docker-compose build --no-cache
But if you want something more destructive:
docker-machine rm default
docker-machine create default
eval $(docker-machine env default)

Docker out of space with vfs driver

I'm trying to run an image of wordpress in docker 1.6.2 with kernel 2.6.32-042stab106.4, I'm tight on that kernel because docker is installed in a VPS.
When Docker tries to download the image the system ran out of space.
I tried to change the driver the storage driver to device mapper but then the docker daemon does not start.
Make sure you periodically clean up old images/containers to free up space:
#!/bin/bash
# Delete all containers
sudo docker rm $(sudo docker ps -a -q)
# Delete all images
sudo docker rmi $(sudo docker images -q)

Resources