Re-create OC docker container - DB access denied

I’m trying to re-create my docker container for my OC installation on another machine.

I pulled all the octobercms-files from git and then cd to the folder one step above to do:

bash -c "$(curl"

It successfully re-created the DB files, so I did a composer install in the docker container, adding my credentials.

But in the messages of my new docker desktop container it said:

Copying MySQL database files to /var/lib/october-mysql...
Starting MariaDB database server: mariadbd.
mysqld is alive
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Now my DB is empty and I can’t php artisan october:migrate.

Should I have to put my database-files also under git or did I misunderstood something else?

I now created a fresh OC docker installation to get a proper DB, then I copied my theme and my plugin inside and did run composer install.

It was a bit trickier to put that under GIT again.

This worked, but I guess, there should be an easier way…

Hi @maki3000,

I was able to restore a container and the database. In your description you don’t mention the octobercms-database directory. Did you copy it to the other machine too?

That’s how I tested the the restoring feature:

  1. Installed the Docker image using the Interactive Bash Script for macOS
  2. Logged into the October CMS backend and created some test data.
  3. Deleted the container.
  4. Copied the octobercms-database and octobercms-files directories to a new directory. I think it corresponds to your step where you pull octobercms-files from git.
  5. Executed bash -c "$(curl" in the new directory.
drwxr-xr-x@ 14 alexey  staff   448 25 Nov 16:06 octobercms-database
drwxr-xr-x@ 33 alexey  staff  1056 25 Nov 16:05 octobercms-files
docker-test-2 $ bash -c "$(curl"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3353  100  3353    0     0  16934      0 --:--:-- --:--:-- --:--:-- 16849
The octobercms-database directory already exists, we will use it.
The octobercms-files directory already exists, we will use it.
Enter a TCP port number for accessing the application in a browser. Leave empty to use the default port 8080.
Enter a TCP port number for accessing the MySQL server running in the container. Leave empty to use the default port 3333.
MySQL port: 
Enter the container name. Leave empty to use the default value "octobercms-dev".
Container name: 
Pulling the latest October CMS Dev docker image...
latest: Pulling from octobercms/october-dev
Digest: sha256:4fed7e171d722c48ea8a16831d651aee1c5c3d781130ce1b325b0cd8a9aa4d23
Status: Image is up to date for octobercms/october-dev:latest
Creating the container...
Configuring the container. It can take several minutes.

The container has been successfully created and started.
Installation URL: http://localhost:8093
Platform files: /Users/alexey/tmp/docker-test-2/octobercms-files
MySQL command to access the database: mysql --host= --user=root --password=root --port=3333 octobercms
Container name: octobercms-dev

After that I logged into October CMS running and the new container and confirmed that all the data was restored.

If you use git for copying your files between the machines, please note that it can change file permissions. If there’s an issue with permissions, I’d compare file permissions in the database folder on the source and destination machine. But your case it doesn’t look like a file permissions issue.

I hope this helps,

Hey @alexey.bobkov

So would you put the octobercms-database folder also under GIT?
I thought, I put only the files under GIT, but maybe that’s wrong.

Hi @maki3000,

Both directories are needed for restoring a container. I haven’t tested moving a container to another machine tho. I would stop the source container before copying the database files. Make sure to add hidden files to Git - in both octobercms-database and octobercms-files directories. Maybe copying ZIP archives would be better than copying individual files.

1 Like