DevOps


JENKINS


Jenkins Installation

To Start Jenkins: java -jar jenkins.war –httpPort=9090

Install Rsync using cygwin

rsync on windows os


Docker Container


How to create docker image


How to create docker image

  1. Create Docker file
    FROM php:7.0-apache
    COPY src/ /var/www/html
    EXPOSE 80
#docker build -t image-filename docker-file-location
> docker build -t hello-world . 
#sudo docker run -p localpot:imageport image-name
> sudo docker run -p 8989:80 image-name

How to export and import image

You will need to save the docker image as a tar file:

docker save -o <path for generated tar file> <image name>

Then copy your image to a new system with regular file transfer tools such as cp or scp. After that you will have to load the image into docker:

docker load -i <path to image tar file>

PS: You may need to sudo all commands.

Ref: Link: https://stackoverflow.com/questions/23935141/how-to-copy-docker-images-from-one-host-to-another-without-via-repository


How to remove container and images

Docker ps -a               # Lists containers (and tells you which images they are spun from)
Docker images              # Lists images  
Docker rm <container_id>   # Removes a container

Docker rmi <image_id>      # Removes an image 
                           # Will fail if there is a running instance of that image i.e. container

Docker rmi -f <image_id>   # Forces removal of image even if it is referenced in multiple repositories, 
                           # i.e. same image id given multiple names/tags 
                           # Will still fail if there is a docker container referencing image

Ref Link: https://stackoverflow.com/questions/33907835/docker-error-cannot-delete-docker-container-conflict-unable-to-remove-reposito