Docker EXEC operations

@Inderpreet @kodekloud-support3 In this task, i first installed apache2 using apt then during installation it asked me where to install it (Country and region)and after installation , systemctl command is not supported. Vi is also not supported.

Hello, @pratikshag
You can take help of sed command to change the port number in the file.

Hi, I am solving this task currently, and I have my doubts as the question asks to install apache2 within the docker container. and configure the port to 8082 which should not bind any specific IP or hostname only but should allow other such as localhost, 127.0.0.1 or container ip etc etc. I have done this sofar:

docker exec it kkloud /bin/sh
apt install apache2 -y
cd /etc/apache2
sed -i ‘s/Listen 80/Listen 8082/g’ ports.conf
sed -i ‘s/:80/:8082/g’ 000-default.conf
sed -i ‘s/#ServerName www.example.com/ServerName localhost/g’ 000-default.conf

are the above steps fine for this task? Please kindly reply.

Do you need to stop and star the container for these settings to take effect?

nope not needed, it should automatically pickup after you create the container.

Here is how I got my task done.

docker exec -it kkloud /bin/sh
apt install apache2 -y
apt install vim -y # In case you want to vi into the port.conf file

cd /etc/apache2
ls -l

sed -i ‘s/Listen 80/Listen 5001/g’ ports.conf
sed -i ‘s/:80/:5001/g’ apache2.conf
sed -i ‘s/#ServerName www.example.com/ServerName localhost/g’ apache2.conf

service apache2 start
service apache2 enable
service apache2 status