Skip to main content

how to upload a new image in docker

Docker makes it easy to develop and deploy custom and consistent environments that include specific applications and dependencies.
Docker calls these compilations Images. Docker images can be hosted and retrieved from private locations or from the official repository, Docker Hub.

Create a Docker ImagePermalink

Create a new local image based on the latest Ubuntu Docker image. Although the repository already has a number of LAMP stack images available, we create one in this guide as an example of the process.
  1. Pull the latest Ubuntu image:
    docker pull ubuntu
    
  2. Create the new container, such that we can add our LAMP stack to Ubuntu. This example names the container lamp-server-template and adds the bash option to the docker command to enter the container in order to continue making changes:
    docker run --name lamp-server-template -it ubuntu:latest bash
    
  3. Install the lamp-server metapackage inside the container:
    apt-get install lamp-server^
    
    This upgrade and installation will take longer than it would if you were working on a standard server. During the installation of the LAMP stack, you will be prompted to create a MySQL root user password. When the installation completes, exit the container:
    exit
    
  4. Use docker ps -a to list all of the available containers:

Commit Changes to the ImagePermalink

To commit changes to the image, we must first have the container ID. As with the example above, the docker ps -a command lists the ID as d09dd0f24b58. We’re going to name our new image lamp-server-template and commit the changes with the command:
docker commit d09dd0f24b58 lamp-server-template
If you run the docker images command, you’ll see the new image, lamp-server-template listed.

Tag Your Image for Version ControlPermalink

When you pull down an image from Docker Hub, the Status line includes the image tag as shown here:
Status: Downloaded newer image for ubuntu:latest
Docker tags are an easy way for you to know what version or release you are working with. This is especially useful for creating new images from a base image. For example, if you have a Ubuntu image you use as a base to create different images, Docker tags help you track the differences:
lamp-server-template:v1.8.10.2017
lamp-server-template:v2.8.10.2017
lamp-server-template:v3.8.10.2017
  1. Create image tags with a docker commit. Using the example tags above, tag the new image with a version number and date:
    docker commit d09dd0f24b58 lamp-server-template:v1.8.10.2017
    
  2. Run docker images to see the new image created along with the associated tag:

Push Your Image to Docker HubPermalink

  1. Before pushing the image to Docker Hub, add a description, your full name (FULL NAME in the example here), and Docker Hub username (USERNAME) in the docker commit:
    docker commit -m "Added LAMP Server" -a "FULL NAME" d09dd0f24b58 USERNAME/lamp-server-template:v1.8.10.2017
    
  2. Once this is fully tagged, log in and push it to Docker Hub:
    docker login
    
  3. You will be prompted for your Docker Hub credentials. When authentication succeeds, you will see Login succeeded. Now, you can push the image to the Hub with the command:
    docker push lamp-server-template:v1.8.10.2017
    
  4. Open a browser, log in to your Docker Hub account, and go your main repository. You will see the new image listed. Click on the image and then click on the Tags tab to see the added tag:
And that is all there is to creating a new image, changing the image, committing your changes, tagging the image, and pushing the complete image to Docker Hub, all handled directly from your Linode.

More Information

You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

Comments

Popular posts from this blog

Machine Learning with ML.NET 1.0

As a person coming from .NET world, it was quite hard to get into  machine learning  right away. One of the main reasons was the fact that I couldn’t start Visual Studio and  try out  these new things in the technologies I am proficient with. I had to solve another obstacle and learn other  programming languages  more fitting for the job like Python and R. You can imagine my happiness when more than a year ago,  Microsoft  announced that as a part of  .NET Core 3 , a new feature will be available –  ML.NET . In fact it made me so happy that this is the third time I write similar  guide . Basically, I wrote one when ML.NET was a  version 0.2  and one when it was  version 0.10 . Both times, guys from Microsoft decided to modify the  API  and make my articles obsolete. That is why I have to do it once again. But hey, third time is the charm, so hopefully I will not have to do this again until ML.NET 2.0   Anyhow, with  .NET Core 3  we got a new toy to play around. With this tool we ar

Integrating Tensor flow API into ASP.net Web applications for Image detection

Introduction Tensor flow provides advanced Machine Learning API. For the example here we will provide a solution for the Image recognition. The same can be applied to other use cases such as Text recognition or any other data set that needs to solve the problems of AI and Machine Learning such as: Predictive Analytics Cognitive Processes and its Automation e.g. NLP Virtual Agents (Bot’s) Camera Image detection and processing e.g. Industrial Robotics and Drones Text Knowledge Analytics Application Development Steps In the first step we create an ASP.NET application for connecting the camera feed or input data. In the next step Install Tensor flow as per instructions on the website –>  Click here To begin using Tensor flow we need to decide on the model to use for processing input data – There is an option to use either ready-made models or develop on own depending on the problem at hand. For simplicity we will use ready-made model called a deep  convolutional neu

Using Tensorflow Object Detection API to build a Toy detector

Here I extend the API to train on a new object that is not part of the COCO dataset. In this case I chose a toy that was lying around. See gif below. So far, I have been impressed by the performance of the API. The steps highlighted here can be extended to any single or multiple object detector that you want to build. Tensorflow Toy Detector~ You can find the code on my  Github  repo Collecting data The first step is collecting images for your project. You could download them from google ensuring you have a wide variation in angles, brightness, scale etc. In my case I created a video of the little aeroplane toy and used  Opencv  to extract images from the video. This saved me a lot of time. I ensured that images were taken from multiple angles. You can also randomly change brightness for some of the images so that the detector can work under different conditions of lightning. Overall 100–150 pics will suffice. See some sample images below: Sample images P