Tuesday, November 25, 2014

Creating and Posting Docker Images


Easy Steps to follow:

I performed these steps to download a CentOS image - > Installed Cassandra -> Posted to my public repository after tagging -

1. Execute  - "docker images" - to check what all images you have available in your local docker repository



2. Now, pull or download the docker repository for your base OS

docker pull centos:latest
docker pull centos:centos6 (in case you need version 6)

3. again run the docker images command and check that the image is now available locally, note down the image-ID

4. Create the Docker container with the run command and specify the bash shell to be executed on completion. This will leave us with a bash session which we can use the customise the image.

5. Replace the ad892dd21d60 ID with the ID of the image we downloaded in the previous step.

  • $ docker run -i -t ad892dd21d60  /bin/bash
  • root@3a09b2588478:/#
You now have an active shell on the container which has been created with the id 3a09b2588478. Type exit to end the session in your guest container and the container will be stopped and kept available on your Docker system.

6. docker ps -a will show all the available container in your local docker repo

7. Let's use container ID 3a09b2588478 for the rest of this example but yours will be a different ID.

$ docker start 3a09b2588478
We can now attach to the container to create a shell where we can make our modifications.

$ docker attach 3a09b2588478
You now have a shell running on the container which you can use to make your changes to the container.

8. Now install Cassandra using the steps mentioned in the two post back.

9. After installation commit and then push



note that I have committed it to my repository that I have made it available publicly on docker website. My repository is my <user_name>/<repository_Name> i.e. mdshiraz/mdshiraz_adobe_test



10. Later push it:



11. After pushing your image will be visible in the docker repo



12. now, go to any other centos machine, pull this docker image using docker pull mdshiraz/mdshiraz_adobe_test:centos6-cassandra


No comments:

Post a Comment