1.

Develop your own custom test environment and publish it on the docker hub.

Answer»

Write instructions in a dockerfile.

  • build the dockerfile and create an image in the registry

docker build -t learn_docker dockerFiles/

  • Create a container by running this image

docker run -it learn_docker

  • Push the container to the docker hub.

--Tag the local image as:

<hub-user>/<repo-name>:[:<tag>]

Examples:

docker tag learn_docker divyabhushan/learn_docker:dev docker tag learn_docker divyabhushan/learn_docker:testing

--list the images for this container:

Divya1@Divya:~ $docker images REPOSITORY                  TAG IMAGE ID            CREATED SIZE divyabhushan/learn_docker   develop 944b0a5d82a9        About a minute ago 88.1MB learn_docker                dev1.1 944b0a5d82a9        About a minute ago 88.1MB divyabhushan/learn_docker   dev d3e93b033af2        16 MINUTES ago 88.1MB divyabhushan/learn_docker   testing d3e93b033af2        16 minutes ago 88.1MB Push the docker images to docker hub docker push divyabhushan/learn_docker:dev docker push divyabhushan/learn_docker:develop docker push divyabhushan/learn_docker:testing The push REFERS to repository [docker.io/divyabhushan/ learn_docker] 53ea43c3bcf4: Pushed 4b7d93055d87: Pushed 663e8522d78b: Pushed 283fb404ea94: Pushed bebe7ce6215a: Pushed latest: digest: sha256:ba05e9e13111b0f85858f9a3f2d3dc0d6b743db78880270524e799142664ffc6 size: 1362

  • Image: Screenshot from the Docker hub.
  • Docker hub repository: learn_docker has DIFFERENT variations of images. Image names are tagged.
  • We can pull the tags from this repository as PER the need.

Summarize:

Develop your application CODE and all other dependencies like the binaries, library files, downloadables required to run the application in the test environment. Bundle it all in a directory.

  • Edit the dockerfile to Run the downloadables and replicate the desired production environment as test env.
  • Copy the entire application bundle to the test env in the docker container.
  • Build the dockerfile and create new docker image and tag it.
  • Push this docker image to the docker hub, which is now downloaded by other users to test.

NOTE: This docker image has your application bundle = application code + dependencies + test run time environment exactly similar to your machine. Your application bundle is highly portable with no hassles.



Discussion

No Comment Found