2

Working with a Docker file which includes PHP, Apache, and MySQL. I was able to get the page to pull up in localhost. However, I am unable to get the MySQL running.

# Use an official PHP Apache runtime as a parent image
FROM php:7.0-apache

# Set the working directory to /var/www/html/
WORKDIR /var/www/html/

# Install mysqli extensions
RUN docker-php-ext-install mysqli && \
apt-get update && \
apt-get install -y zlib1g-dev && \
apt-get install -y libxml2-dev && \
docker-php-ext-install zip && \
docker-php-ext-install xml

# Make port 80 available to the world outside this container
EXPOSE 80

Based on the above, when I attempt to run the following command:

docker run --name some-mysql -e MYSQL_abcd_123456=my-secret-pw -d mysql:tag

I receive the following error in the terminal:

Unable to find image 'mysql:tag' locally
docker: Error response from daemon: manifest for mysql:tag not found.

What am I missing?

2
  • 1
    Is that your exact command? Use a real tag instead of "tag". Check the image documentation on DockerHub. Commented Apr 2, 2019 at 0:07
  • Well, I did alter the password part. But other than that, yes. That is the command. Commented Apr 2, 2019 at 0:11

1 Answer 1

2

docker run command requires the image name parameter with optional version of the image (recommended).

Use:

docker run --name some-mysql -e MYSQL_abcd_123456=my-secret-pw -d mysql:latest

to pull the latest mysql image or choose the exact version listed by supported tags

for example:

5.7.25

or

8.0.15

In majority cases you should not use the tag with the version latest (or skip the version) because that is ambiguous and can give you different versions of the image on two different machines even they used for the build the same Dockerfile FROM statement or you used the same docker run (docker pull) command. Read more

I would recommend always stick to the explicit version number if possible, for example:

docker run --name some-mysql -e MYSQL_abcd_123456=my-secret-pw -d mysql:8.0.15
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.