Removing Container from Docker via Command Line

To be able to remove container running and managed by docker is actually easy. But first of all, it need to be checked first whether the running container which is going to be removed is really exist or already run. Below is the command which can be be used :

docker run rm -f image_name

But, we can remove the container by adding several optional parameter as shown in the command execution below :

[root@hostname ~]# docker run --rm -d --name php4 -h php4 -p 80:80 -v /document_root_path_on_host/:/document_root_path_on_container/ cmfatih/php4 /usr/local/apache2/bin/apachectl -D FOREGROUND
Conflicting options: --rm and -d
[root@hostname ]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                NAMES
cd80c72aa858        cmfatih/php4        "/usr/local/apache2/b"   2 minutes ago       Up 2 minutes        0.0.0.0:80->80/tcp   php4
[root@hostname ~]# 

But the above command has failed, since the detached mode of container cannot be remove only with the –rm optional parameter as shown in the above output :

Continue reading “Removing Container from Docker via Command Line”

Running Docker Application for Apache Webserver supporting PHP4

Docker is a software used to run a specific application and isolated within a securely container which is equipped with the necessary libraries and package so that the application itself can run properly.

The need of running Apache Webserver with the older version of PHP is urgent since a web-based application which is developed with a certain framework, in this context Code Igniter (CI) is still running with the old version of CI 1.7.1.

An alternative solution rises by choosing to run the application in  Apache Webserver emulated by docker which is equipped with PHP version that support Code Igniter 1.7.1.

To be able to see the perfect or the suitable Webserver designed so that it will be able to run and to execute the application based on Code Igniter 1.7.1, below is the list of resource available in Docker Official Repositories.

Below is the attempt and effort to fullfill the scenario :

1. Make sure that the docker service has already been installed, enabled and run. For more information, it can be viewed by referring to this article titled ‘Install Docker in CentOS 7 via command line‘.

Below is the sample of execution of the above scenario :

Continue reading “Running Docker Application for Apache Webserver supporting PHP4”

Install Docker in CentOS 7 via command line

Docker is one of virtualization type or technology which is used in the application level. It can be used to virtualize service or application running inside an operating system.

The motto of Docker is “Docker is the world’s leading software containerization platform” and it can be visited in the following URL of Docker official website.

Below is the step on installing docker on an operating system of CentOS 7.1511 :

1. Create docker repository file. It is normally created in /etc/yum.repos.d. Name the new repository file as ‘docker.repo’. Accomplish it using the following executable command :

vim /etc/yum.repos.d/docker.repo

Below is the executable command of the above line :

Continue reading “Install Docker in CentOS 7 via command line”