I had previous success following this walkthrough on creating a series of docker containers that allowed me to use MySQLI, PHP, and phpmyadmin:
https://gist.github.com/jcavat/2ed51c6371b9b488d6a940ba1049189b
I decided to try it again and make a few tweaks, such as trying to PDO instead of MYSQLI.
Starting with the docker-compose.yml file:
version: "3.7"
services:
www:
build: .
ports:
- "8001:80"
volumes:
- ./www:/var/www/html/
links:
- db
networks:
- default
db:
image: mysql:5.7.13
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: myDb
MYSQL_USER: user
MYSQL_PASSWORD: test
MYSQL_ROOT_PASSWORD: test
volumes:
- ./dump:/docker-entrypoint-initdb.d
- persistent:/var/lib/mysql
networks:
- default
phpmyadmin:
image: phpmyadmin/phpmyadmin
links:
- db:db
ports:
- 8000:80
environment:
MYSQL_USER: user
MYSQL_PASSWORD: test
MYSQL_ROOT_PASSWORD: test
volumes:
persistent:
Here is my Dockerfile:
FROM php:7.0.30-apache
RUN docker-php-ext-install pdo pdo_mysql
Now if you'll reference the tutorial link above, I altered the myDb.sql file. Instead of creating the table called 'Person', I created a table called 'users'. I did not want to paste the whole myDb.sql file, but here is the CREATE TABLE portion:
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`firstName` varchar(30) NOT NULL,
`lastName` varchar(50) NOT NULL,
`username` varchar(20) NOT NULL,
`email` varchar(100) NOT NULL,
`department` varchar(50) NOT NULL,
`title` varchar(30),
`phone` varchar(30),
`addDate` datetime(),
`addUser` varchar(30) NOT NULL,
`lastLogin` datetime()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Then the insert:
INSERT INTO `users` (`id`, `firstName`, `lastName`, `username`, `email`, `department`, `title`, `phone`, `addDate`, `addUser`) VALUES (1, 'William', 'Wheaton', 'usa.wwheaton', '[email protected]', 'Engineering', 'Ensign', '7577771212', NOW(), 'admin');
I also added another create table script that I won't include, as this question is getting long.
Upon running the command 'docker-compose up', I receive the following error:
Building www
Traceback (most recent call last):
File "site-packages/dockerpycreds/store.py", line 74, in _execute
File "subprocess.py", line 336, in check_output
File "subprocess.py", line 418, in run
subprocess.CalledProcessError: Command '['/usr/local/bin/docker-credential-osxkeychain', 'get']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "site-packages/docker/auth.py", line 129, in _resolve_authconfig_credstore
File "site-packages/dockerpycreds/store.py", line 35, in get
File "site-packages/dockerpycreds/store.py", line 87, in _execute
dockerpycreds.errors.StoreError: Credentials store docker-credential-osxkeychain exited with "The user name or passphrase you entered is not correct.".
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "docker-compose", line 6, in <module>
File "compose/cli/main.py", line 71, in main
File "compose/cli/main.py", line 127, in perform_command
File "compose/cli/main.py", line 1080, in up
File "compose/cli/main.py", line 1076, in up
File "compose/project.py", line 475, in up
File "compose/service.py", line 358, in ensure_image_exists
File "compose/service.py", line 1082, in build
File "site-packages/docker/api/build.py", line 251, in build
File "site-packages/docker/api/build.py", line 307, in _set_auth_headers
File "site-packages/docker/auth.py", line 96, in resolve_authconfig
File "site-packages/docker/auth.py", line 146, in _resolve_authconfig_credstore
docker.errors.DockerException: Credentials store error: StoreError('Credentials store docker-credential-osxkeychain exited with "The user name or passphrase you entered is not correct.".',)
[49981] Failed to execute script docker-compose
I am not sure why this is failing to run. I am not even sure why the error message states that I am using the wrong name or passphrase.
What am I missing or what do I need to fix that will get this to run properly?
It is an issue with docker build; cos, the docker hub login must fail in your case (this might have happened with multiple docker login registry in your config file)
If you want a quick fix, delete the .docker/config.json
file and login docker before you run docker-compose up
sudo rm ~/.docker/config.json
docker login
docker-compose up
Note: a new ~/.docker/config.json
file will be created on your successful login
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With