Gitlab CI for apache project

Recently I have started working on Gitlab and as part of learning I have focused on the Gitlab CI process for my future projects. I have installed gitlab runner with executor as docker. Till here everything is fine. I have got a website which contains HTML pages and I am deploying it in the default apache web server path (/var/www/html). Here is the .gitlab-ci.yml file I am using for the build:

image: centos:7

   - yum install -y httpd git ssh
   - cp -R HTML/* /var/www/html/

Till here the build is getting properly but in order to make the apache up and run the test I am unable to do it. When I add this command in the script, e.g.:

  • exposing Mongodb from docker container on server
  • docker-compose isn't installing bower components inside the docker container
  • Build many dockerfiles on jenkins project
  • Nodejs development on Docker under Windows 10
  • Can't access service running in docker
  • What is the overhead of creating docker images?
  • image: centos:7
       - yum install -y httpd git ssh
       - cp -R HTML/* /var/www/html/
       - sudo apachectl start or /usr/sbin/httpd start

    …I am getting an error as “Command not found”.

    How to make the apache instance up and test?

  • Docker config file location on windows to, e.g., enable insecure registry / docker options
  • Docker can't connect to the internet from with proxy
  • monitoring memory usage in docker
  • Docker with ElasticSearch none-root permission issue
  • Docker for Windows and docker-maven-plugin - “SSLException: Unrecognized SSL message, plaintext connection” error
  • Publishing a port in gitlab-ci-runner using docker
  • One Solution collect form web for “Gitlab CI for apache project”

    Docker containers by default run as root, so there’s no need to sudo and I don’t believe the centos image from the Docker Hub includes the tool.

    When running a process as a container, you don’t launch it via systemd or any of the other init systems, you need to spawn it as a foreground process for docker to attach to. It becomes pid 1, it’s the only process launched (no ssh daemon or other processes you may expect), and when it exits or is killed, the container is stopped. The way to do this with apache according to the repository on Docker Hub where it’s already created is the following Dockerfile entry:

    CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.