I’m new to docker can someone help me ? i have 3 separate images http, php, mysql, how can i use this 3 images all together? please see the photo
You can write a compose file and start a container for each of them. Take a look at the docs for docker-compose and compose files.
version: ‘3.3’
services:
web:
image: ivsndhdang/php5.1.6
container_name: php
volumes:
- ./php:/usr/local/apache2/htdocs/
ports:
- 8000:80
links:
- http
- db
db:
container_name: mysql
image: mysql:latest
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test_db
MYSQL_USER: devuser
MYSQL_PASSWORD: devpass
ports:
- 6033:3306
http:
build:
context: .
dockerfile: Dockerfile
container_name: http
volumes:
- ./php:/usr/local/apache2/htdocs/
links:
- db
but its not working
FROM httpd:2.4
COPY php /usr/local/apache2/htdocs/
EXPOSE 80
help anybody? all the tutorials nothing like this
Sorry, I was not here for some days.
A setup with http, php and mysql isn’t so difficult, but can you please format your previous messages in a way that it is possible to see the indentations?
version: ‘3.3’
services:
web:
image: ivsndhdang/php5.1.6
container_name: php
volumes:
- ./php:/usr/local/apache2/htdocs/
ports:
- 8000:80
links:
- http
- db
db:
container_name: mysql
image: mysql:latest
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test_db
MYSQL_USER: devuser
MYSQL_PASSWORD: devpass
ports:
- 6033:3306
http:
build:
context: .
dockerfile: Dockerfile
container_name: http
volumes:
- ./php:/usr/local/apache2/htdocs/
links:
- db
if you can try on your docker? let me know
Look at your post, everything is left aligned. You have to start with 3 backticks and end with 3 backticks, like this:
this
is
code