Container, Docker, Docker Info, How To, Image, Information, Instalation & Configuration, Kill, List, Networks, Prune, Remove, Start, Stop, Tip & Tricks, Volumes, Wipe Docker

Docker Maintenance

Continuing from where we left in previous post, if not seen you can visit here.

During development, your resource utilization can grow unorganized with old, outdated, and unused components. Where you may require maintenance to manage, free resources and reclaim for other uses.

Let’s learn few commands which will be useful to work and maintain docker containers, images and other resources.

Today we will learn how to organize a Docker environment by removing Docker images, containers, volumes, and networks. 

Using these commands makes Docker container management fast and easy.

A container creates a specific environment in which a process can be executed. As we all are aware of many containers are created over time, tested, and uninhibited during the development lifecycle.

Therefore, it’s important to know how to find unnecessary containers and remove them.

First, you will need to list all Docker containers using the command:

docker container ls -a

This will list all running containers, their IDs, names, images, status and other parameters.

Most of the time you are only interested to have list of all the containers only by their numeric ID’s, that you can obtain running the command:

docker container ls –aq

To stop a specific container, enter the following:

docker container stop [container_id]

Replace [container_id] with the numeric ID of the container from your list.

You can enter multiple container IDs into the same command.

To stop all containers, enter:

docker container stop $(docker container ls –aq)

This forces Docker to use the list of all container IDs as the target of the stop command.

To launch or start a single or multiple stopped Docker containers

docker start [options] container_id

List all Docker Resources

Enter the following commands to display resources:

docker info

docker container ls

docker image ls

docker volume ls

docker network ls

The above-mentioned lists number of containers, images, and information about the Docker installation. These commands can help you locate and identify resources that you want to keep, or that you want to delete.

Remove a Stopped Container

To remove a stopped container, use the command:

docker container rm [container_id]

Remove All Stopped Containers

To remove all stopped containers:

docker container rm $(docker container ls –aq)

Remove All Docker Containers

To wipe Docker clean and start from scratch, enter the command:

docker container stop $(docker container ls –aq) && docker system prune –af ––volumes

Let’s decode above command line as:

docker container ls –aq

will list all containers with their numeric ID

docker container stop

will stop all containers obtained from above list

&& docker system prune –af ––volumes

Will remove all stopped containers and volumes

Here (a) indicates this should apply to all containers &(f) without a required confirmation.

How to Remove Docker Images

Docker images are files, which include multiple layers used to run code within a container.

Images may go through many iterations during development. Old and outdated images can clutter your system, taking up storage space and making searches more difficult.

To remove a Docker image, start by listing all the images on your system:

docker image ls

The output displays the locally available Docker images, as seen below.

Make a note of the IMAGE ID – this is the identifier used to remove the image.

Then, remove the unwanted image(s):

docker image rm [image_id1]

Replace [image_id1] with the image ID you pulled from the first command. You can enter a single Image ID, or multiple IDs for removal.

The system may respond to your request with an error message, that there is a conflict and it is unable to remove the repository reference.

This indicates that a container is using the image. You need to remove the container first before you can remove the image.

How to Remove Docker Volumes

A volume is used to store Docker data.

It helps store and organize data outside containers in a way that it’s accessible to multiple containers.

Use the following command to generate a list of all the available Docker volumes:

docker volume ls

Take note of the VOLUME NAME you want to remove.

Then enter:

docker volume rm VolumeName

Make sure to replace VolumeName with the actual name you generated with the previous command.

If the volume is in use by an existing container, the system responds with an error. This means need to remove the container first.

How to Remove Docker Networks

Docker networks allow different containers to communicate with each other freely while also preventing traffic from outside the network. This is typically done with a Docker bridge network.

The prune command removes all unused networks.

Removing a Single Network

Display a list of all existing Docker networks with the command:

docker network ls

Take note of the NETWORK ID – this is the identifier used to remove a specific network. Then, enter:

docker network rm [networkID]

Replace [networkID] with the ID you captured from the first command.

You may receive an error message that says the network has active endpoints. That means that the network is currently in use by containers. You need to remove the containers that are using the network before you can remove the network.

Remove All Unused Docker Objects

The prune command automatically removes all resources that aren’t associated with a container. This is a streamlined way to clean up unused images, containers, volumes, and networks.

In a terminal window, enter the following:

docker system prune

Additional flags can be included:

a To include stopped containers and unused images

–f  Bypasses confirmation dialog

––volumes Removes all unused volumes

Also, you can specify a single type of object to be removed, instead of the entire environment:

docker container prune

docker image prune

docker volume prune

docker network prune

Running docker system prune -a removes both unused and dangling images. Images used in a container, either currently running or exited, will NOT be affected.

Finally, my docker is clean:

May come with more commands and maintenance tips in future post. While writing this post I was using limited resources, so was unable to attach screen shot for each command. In future may add more scenarios.

Till then keep experimenting & learning.

Container, Containerization, Docker, Image, Kill, List, Start, Stop, Tip & Tricks

Docker Basics

Like any other software, Docker introduces users to a new range of terminology related to its services. Users need to get familiar with concepts such as Dockerfilesimagescontainers, and other Docker-specific words.

Once you have mastered the vocabulary, the next step is to get used to using Docker commands. A list of all the commands and options is quite extensive and would take time to learn them all by heart.

What is Docker?

Docker is a popular virtualization tool that replicates a specific operating environment on top of a host OS. It is used by development teams to ensure consistency across different machines. It is a software that offers a set of platform-as-a-service products for developing and deploying applications by packaging software in containers.

What is Container?

A container uses an image of a preconfigured operating system optimized for a specific task. When a Docker image is launched, it exists in a container. For example, multiple containers may run the same image at the same time on a single host operating system.

Containers are designed to provide a self-sufficient environment, with all the libraries and configurations needed for the software to execute.

Containers are lightweight, portable, virtual environments that developers can share without risking inconsistencies in development. Due to these incredibly useful features, now organizations are switching from using virtual machines to Docker containers.

What is Containerization?

Containerization is defined as a form of operating system virtualization, through which applications are run in isolated user spaces called containers, all using the same shared operating system (OS).

No matter if you are new to Docker or already have some experience with containerization, it is always good to have a reference point for all the common Docker commands.

During development, they can grow unorganized with old, outdated, and unused components. Where require maintenance to manage, free resources and reclaim for different uses.

Let’s learn few commands which will be useful to work and maintain docker containers, images and other resources.

We will see few options to list, start, and stop, Docker containers.

The basic format for using docker is:

docker command [options]

To list all running Docker containers

docker ps

To list all containers, both running and stopped

docker ps –a

Since I am having only one container running at moment, so to show difference from previous command I stopped the container.

Now I have started the container and issued same commands as above.

Conclusion:

Docker ps lists only running containers

Docker ps -a lists running and stopped containers.

To list containers by their ID

docker ps –q

My Container was running

Remember from above Docker ps -a lists running and stopped containers. My Container is stopped

To list the total file size of each container

docker ps –s

You can check supported options using:

Use the docker stop command to stop a container:

docker stop [option] container_id

By default, you get a 10 second grace period. The stop command instructs the container to stop services after that period. Use the –time option to define a different grace period expressed in seconds:

docker stop –time=20 container_id

To Start Container

docker start container_id

To immediately kill a docker container without waiting for the grace period to end use:

docker kill [option] container_id

To stop all running containers, enter the following:

docker stop $(docker ps –a –q)

The same command could be used with kill. This would stop all containers without giving them a chance to exit.

Don’t forget to check next post where we will discuss about commands helpful in doing maintenance of containers.

Azure, Development Tips, Dynamics 365, Functional Tips, How To, Image Analyzer, Information, Instalation & Configuration, NAV 2018, Tip & Tricks, What's New

Image Analysis feature in Dynamics NAV 2018

In Dynamics NAV 2018, the Image Analyzer extension uses the Computer Vision API to analyze images that are attached to contact persons and items.

For example, this is useful for items because it lets you build up a stockpile of metadata about what you sell and use it to fine-tune search results when someone is browsing your web shop.

Image Analyzer is free in Dynamics NAV, but there is a limit to the number of items that you can analyze during a certain period of time. By default, you can analyze 100 images per month.

After you enable the extension, Image Analyzer runs each time you import an image to an item or contact person. You will see the attributes, confidence level, and details right away, and can decide what to do with each attribute. If you imported images before you enabled the Image Analyzer extension, you must go to the item or contact cards and choose the Analyze Picture action.

Requirements

There are a few requirements for the images:

  • Image formats: JPEG, PNG, GIF, BMP
  • Maximum file size: Less than 4 MB
  • Image dimensions: Greater than 50 x 50 pixels

How to enable Image Analyzer

To enable the Image Analyzer extension, do one of the following:

Method-1 : Open an item or contact card. In the notification bar, choose Analyze Images, and then follow the steps in the assisted setup guide.

 

IA-1

This will launch Image Analyser assisted setup guide, follow the step.

 

IA-2

IA-3

IA-4

Once you are done It will import your image for Analysing.

IA-5

 

Method-2 : Access the Service Connections, and then choose Image Analysis Setup.

IA-5.1

Choose the Enable Image Analyzer check box, and then complete the steps in the assisted setup guide.

IA-5.2

For URL and Key follow these steps:

Click on Computer Vision API Documentation

IA-6

Click on Try Computer Vision API

IA-7

Select your API Computer Vision API and then Get API Key

IA-8

Agree to T & C select your Country/Region and then Next

IA-9

Sign-In with the preferred account sign-in method

IA-10

Once done you will land on page which will have your Endpoint URL and Key

You must add /analyze at the end of the API URI, if it isn’t already there.

IA-11

Enter your Endpoint URL and Key and close the window.

IA-12

Now you import your Image, or select Analyze Picture if already imported

IA-13

This will analyze the Image and provide you with the Attributes.

The Image Analyzer Attributes page displays the detected attributes, the confidence level, and other details about the attribute. Use the Action to perform options to specify what to do with the attribute.

 

This is how you enable and configure your Image Analyzer Service.

 

To see how many analyses you have left in the current period

You can view the number of analyses you’ve done, and how many you can still do, in the current period.

Enter Image Analyzer Setup, and then choose the related link.

The Limit type, Limit value, and Analyzes performed provide the usage information.

 

To stop using the Image Analyzer extension

Enter Service Connections, and then choose Image Analyzer Setup.

Clear the Enable Image Analyzer check box.

 

I will come with more details as I proceed.

 

 

 

Report

Designing Report Layouts from the Microsoft Dynamics NAV Development Environment

After you have created a dataset for a report, you design the report layout. The report layout determines how the report looks when it is viewed, printed, and saved from the Microsoft Dynamics NAV client. The report layout specifies which fields of the dataset are included in the report and how they are arranged, the format of text that appears on the report (such as font type and color), margins, background images, and more.

You generally display most data in the body of a report, and you use the header to display information before any dataset fields are displayed. For example, you can display a report title, company, and user information in the header of a report.

Report Layout Types

There are two types of report layouts: Word and Client Report Language Definition (RDLC). Word report layouts are based on a Word document (.docx file type) and are created and modified by using Word 2013. RDLC report layouts are .rdlc or .rdl file types that are created and modified by using Visual Studio 2013 or SQL Server Report Builder 3.0.

Built-in and Custom Report Layouts

In the Microsoft Dynamics NAV Development Environment, you can create both an RDLC report layout and Word report layout on a report. These layouts are referred to as built-in layouts because they are part of the report object in the database. This means, for example, if you export the report object as a .fob or .txt file, the RDLC report layout and Word report layout are included. A report can only have one built-in RDLC report layout and one built-in Word report layout. By default, the built-in RDLC report layout is used when the report is run in the Microsoft Dynamics NAV client unless there is only a built-in Word report layout, in which case, the built-in Word report layout is used.

Microsoft Dynamics NAV users can specify whether to use the built-in RDLC or Word report layout on a report from the Microsoft Dynamics NAV Windows client and Microsoft Dynamics NAV Web client. From the client, users can also create custom report layouts that are based on the built-in report layouts. This enables users to have several different layouts for the same report which they can switch among. Custom report layouts are managed from page 9650 Report Layouts in the Microsoft Dynamics NAV client. Unlike built-in report layouts, which are part of the report object, custom report layouts are stored in table 9650 Report Layouts of the database.

Report Layouts in a Multitenant Deployment

In a multitenant Microsoft Dynamics NAV deployment, the built-in report layouts are stored in the application database because they are part of the report objects. Therefore, built-in report layouts are available to all tenants. Custom report layouts are stored in the business data database; therefore they are specific to the tenant. This enables you to create separate report layouts for each tenant.

Report

Adding Image Fields

A report dataset can include a field that contains an image, such as a company logo or a picture of an item. To add an image from the report dataset, you insert a Picture content control.

Images align in the top-left corner of the content control and resize automatically in proportion to fit the boundary of the content control.

Important
You can only add images that have a format (such as .bmp, .jpeg, and .png file types), which that is supported by Word. If you add an image that has a format that is not supported by Word, you will get an error when you run the report from the Microsoft Dynamics NAV client.

To add an image

  1. Place your pointer in the document where you want to add the control.
  2. In the XML Mapping pane, right-click the control that you want to add, choose Insert Content Control, and then choose Picture.
  3. To increase or decrease the image size, drag a sizing handle away from or towards the center of the content control.

AddImage