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.:

  • Bcrypt: invalid ELF header with Docker and Sails.JS
  • How can i access the website running inside a Docker container using IP address of container
  • docker-compose django-postgres error
  • docker untagged images with tag (using docker-compose)
  • 'undo' or 'cancel' dockerfile VOLUME to share mysql DB in registry
  • How to properly deploy to host from gitlab-ci (+docker)?
  • 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 opencv3 Cmake errors
  • WebSphere Docker OAuth
  • Why would I want to to use VOLUME inside a Dockerfile?
  • Nginx connection refused while connecting to Node.js upstream inside a Docker container
  • kubernetes cannot pull local image
  • Can't bootstrap Docker version since 1.11.x for direct-lvm setup (Kubernetes)
  • 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.