E
E
Evgeny Ivanov2022-04-13 15:54:05
Debian
Evgeny Ivanov, 2022-04-13 15:54:05

How to create a Dockerfile for web development (PHP/MySQL need an example)?

I used to raise a VDS server (I am familiar with the commands), but now everything is done in the docker.
I'm learning docker. According to the examples, everything works, but a step to the left, a step to the right are already problems.

Here is an example of my Dockerfile. My task is to install a LAMP "server".
You need to install everything in one container (without linking containers - often mysql is put in a separate container, but I need everything in one).
error 100 occurs at RUN --name some-mysql step. Wrong command syntax?
I took the command from docker hub. It most likely doesn't install anything though (it doesn't have apt-get -y install either).

FROM debian
RUN apt-get update

RUN apt-get -y install nano
RUN apt-get -y install nginx
RUN apt-get -y install mysql-server
RUN apt-get -y install php-fpm php-mysql php7.2-curl php7.2-mcrypt php7.2-mbstring
RUN apt-get -y install vsftpd

RUN --name some-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=mysecretpass -d mysql
EXPOSE 80

Show the correct dockerfile.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dr. Bacon, 2022-04-13
@bacon

You need to install everything in one container
you don’t have to continue, go read the basics about docker, because one service is one container. Info is easily googled, there are plenty of examples, and you can even just go to popular projects on github, and see how they do

R
romaro, 2022-04-21
@romaro

As for the RUN command , it is sent to the shell by default. Try running a Debian-based container and repeat your command in that shell.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question