How to Develop an Image
- Run a Container in itd mode with ubuntu image docker run -itd ubuntu
Go into the container with execute command.
docker exec -it 2cfdc788d068 /bin/bashInstall Java
Download and Install JDK/JRE 11 in Ubuntu
apt-get update
apt-get install openjdk-11-jdk -y
apt install openjdk-11-jdk-headless -yInstall Apache2
Command – apt-get install apache2 -yExit from Container
Search and download Sample.war file and click on the link -> copy link address.
We can see sample.war file is available.
Install wget command and provide permission.
Command - yum install wget -yCopy the sample.war file to the container.
Command: docker cp sample.war 2cfdc788d068:/optValidate we have everything we require.
Like – Java, Apache2, Sample.war
$ docker exec 2cfdc788d068 javaCommit – create the image
$docker commit -m"ub-java-apache2-app" -a"jawahar" 2cfdc788d068 managerappCreate the container from the image
$docker run -itd --name manager managerappVerify everything we require is there in container “manager”
$ docker exec manager java
$ docker exec manager which apache2
$ docker exec manager ls /opt
How to share the image
Create a tarball file
$ docker save -o managerapp.tar managerappLoad Image
$docker load -i managerapp.tar
Share the image with Team – Docker Registry.
Create a registry on docker hub
jawahar108/devopsmanagerapp general | Docker HubLogin to hub.docker.com with your docker user name and password.
$ docker loginTag Docker Images or Alias the image
$ docker tag managerapp jawahar108/devopsmanagerappPush the image to docker
$ docker push jawahar108/devopsmanagerapp
Refresh the docker and click on Public View
jawahar108/devopsmanagerapp - Docker Image | Docker Hub
Docker Pull Command
docker pull jawahar108/devopsmanagerapp
Share the url with manager.
jawahar108/devopsmanagerapp - Docker Image | Docker Hub
Thank You!
Top comments (0)