I can't figure out how to use my containers after they are running in Docker (through docker-compose).
I've been reading up on Docker for the last few weeks and I'm interested in building an environment that I could develop on that and I could replicate efficiently to collaborate with my colleagues.
I've read through the following articles:
<a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-centos-7" rel="nofollow noreferrer">https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-centos-7</a>
<a href="https://www.digitalocean.com/commun...hpmyadmin-with-docker-compose-on-ubuntu-14-04" rel="nofollow noreferrer">https://www.digitalocean.com/commun...hpmyadmin-with-docker-compose-on-ubuntu-14-04</a>
<a href="https://www.digitalocean.com/commun...work-with-docker-data-volumes-on-ubuntu-14-04" rel="nofollow noreferrer">https://www.digitalocean.com/commun...work-with-docker-data-volumes-on-ubuntu-14-04</a>
I've installed Docker and Docker Compose through a Bash script made up of the commands found in the previous articles: (Run as sudo)
And I have a
file for my Docker images. (For now I'm only pulling PHP and Apache as a proof-of-concept, I will include MySQL once can get PHP and Apache working together)
I call a
and I don't receive any errors:
Any my question is:
When I run a
and
after the images are running I receive:
and
If the images are running why am I not able to use PHP or see the status of Apache? How am I supposed to utilize my PHP and Apache containers?
<h1>Update</h1>
I've asked a more informed version of <a href="https://stackoverflow.com/questions/46997791/containerizing-apache-mysql-and-php-with-docker">this question again</a>.
I've been reading up on Docker for the last few weeks and I'm interested in building an environment that I could develop on that and I could replicate efficiently to collaborate with my colleagues.
I've read through the following articles:
<a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-centos-7" rel="nofollow noreferrer">https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-centos-7</a>
<a href="https://www.digitalocean.com/commun...hpmyadmin-with-docker-compose-on-ubuntu-14-04" rel="nofollow noreferrer">https://www.digitalocean.com/commun...hpmyadmin-with-docker-compose-on-ubuntu-14-04</a>
<a href="https://www.digitalocean.com/commun...work-with-docker-data-volumes-on-ubuntu-14-04" rel="nofollow noreferrer">https://www.digitalocean.com/commun...work-with-docker-data-volumes-on-ubuntu-14-04</a>
I've installed Docker and Docker Compose through a Bash script made up of the commands found in the previous articles: (Run as sudo)
Code:
## Install Docker package
function docker_install {
echo "__ installing docker"
# Run installer script
wget -qO- https://get.docker.com/ | sh
# Add user parameter to docker group
usermod -aG docker $1
# Enable docker on boot
sudo systemctl enable docker.service
# Start docker now
sudo systemctl start docker.service
}
## Install docker-compose package
function docker-compose_install {
echo "__ installing docker-compose"
# Update yum repo
sudo yum install epel-release
# Install pip with "yes" flag
sudo yum install -y python-pip
# Install SSL Extension
sudo pip install backports.ssl_match_hostname --upgrade
# Install docker-compose through pip
sudo pip install docker-compose
# Upgrade python
sudo yum upgrade python*
}
# Call Functions
docker_install
docker-compose_install
And I have a
Code:
docker-compose.yml
Code:
php:
image: php
links:
- httpd
httpd:
image: httpd
ports:
- 80:80
I call a
Code:
sudo docker-compose up -d
Code:
Creating containerwrap_httpd_1
Creating containerwrap_php_1
Any my question is:
When I run a
Code:
php -v
Code:
service httpd status
Code:
-bash: php: command not found
and
Code:
● httd.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
If the images are running why am I not able to use PHP or see the status of Apache? How am I supposed to utilize my PHP and Apache containers?
<h1>Update</h1>
I've asked a more informed version of <a href="https://stackoverflow.com/questions/46997791/containerizing-apache-mysql-and-php-with-docker">this question again</a>.