0

I am trying to migrate my development environment from Windows to Linux, which is going fine. However, my setup in Windows was using Vagrant with VirtualBox as the provider to set up the development. I have a Vagrantfile and some Bash scripts to initiate a MariaDB instance and a apache web server.

I have had a lot of issues with VirtualBox on Linux, so I want to migrate to Docker.

Unfortunately some of my scripts stop working as expected when I try to run them on my Windows setup. I have figured out that part of the issue is that executable flags, etc are not committed to git when I commit from the Windows machine. Therefore I would like to conserve the VirtualBox setup and config until the Docker setup works.

The future

To also enable the image that are made in Docker to be used in Kubernetes in the future for end-to-end tests and try to conserve some resources, I have chosen to use Alpine linux.

TL;DR

I am moving from a Ubuntu based monolithic image with everything (apache with ModSecurity and custom rules and MariaDB) installed, to a three container Alpine setup with a MariaDB: for the database, a php:8.2-apache for the web part and an alpine:3.14 image for the db-init work.

The Question

I have a shell script which configures Apache with the relevant extensions I require and restart Apache.

I have a part of that script which is set up like this:

echo "** Restarting apache2"
if command apt &> /dev/null
then
  echo "Assuming Ubuntu in Vagrant..."
  sudo systemctl reload apache2
else
  apache2ctl restart 
fi

But for some reason this stopped working, causing the docker installation to fail because alpine does not have sudo.

I am aware that there are several ways to fix this. I am looking for a stopgap solution, because I expect to have migrated fully to Docker within a year, so any suggestion that can help fix this is much appreciated

0

You must log in to answer this question.

Browse other questions tagged .