How to modify Docker container configuration of Azure? - azure

These pics show my process of deployments on Azure Docker with Eclipse IDE.
The problem is I have no idea how to modify Wildfly Docker configuration. For example, Datasource JNDI and undertow setting of Wildfly AS in Docker container.

You can configure the Docker container as follows:
Predefined Docker image: Specifies a pre-existing Docker image from Azure.
[!NOTE] The list of Docker images in this box consists of several images that the Azure Toolkit has been configured to patch so that your artifact is deployed automatically.
Custom Dockerfile: Specifies a previously saved Dockerfile from your local computer.
[!NOTE] This is a more advanced feature for developers who want to deploy their own Dockerfile. However, it is up to developers who use this option to ensure that their Dockerfile is built correctly. The Azure Toolkit does not validate the content in a custom Dockerfile, so the deployment might fail if the Dockerfile has issues. In addition, the Azure Toolkit expects the custom Dockerfile to contain a web app artifact, and it will attempt to open an HTTP connection. If developers publish a different type of artifact, they may receive innocuous errors after deployment.
For more details, refer https://github.com/Azure/azure-docs-sdk-java/blob/master/docs-ref-conceptual/eclipse/azure-toolkit-for-eclipse-publish-as-docker-container.md.

Related

How to get Docker Images from Azure container registry and run onpremise servers using docker-compose?

I am using azure devops for CI/CD pipelines and one thing I couldn't find out, getting images from Azure container registry and run those images inside of my onpremise debian server. (I build and pushed the images to ACR already).
On release pipeline section:
I set Azure Container repository as source type and selected the latest artifact from there
then created a dev stage
Added a Command line tool to execute some scripts on server
-->This is the step where I lost<-- I need somehow to get these image from repository and fire compose up command in the server.
Extra info: you cannot use your docker-compose.yml(which mine is inside of the azure repo in same project) because you are using ACR as source type, not the build itself or source code.
*in my humble opinion this is a good case to enrich a content. Because there is lack of docs and videos on internet.
thanks,

GitLab community edition - docker support

I would like to know if the community edition of GitLab (Self hosted) has support for a CI process that would include:
Creation of docker containers (docker-compose or Dockerfile)
Save custom docker images to a docker Registry in GitLab
Integrate ansible To manage configuration items
I checked the pricing / feature compare section of their website but I wasn’t able to find this info. Wondering if any fellow stack overflowers that are using this framework already can help out.
Thanks
You can sign up for a free GitLab CE account and try it out. Here's what I found:
Docker Images and Registry
GitLab CE comes with a Package Registry (Maven, NuGet, PyPi, etc.) and Container Registry (for Docker images). However, I don't think GitLab will provide free storage for your packages. The benefit is full integration in your CI/CD pipeline. You'll need to host your own server, as described in How to Build Docker Images and Host a Docker Image Repository with GitLab. The official docs are at GitLab Container Registry.
Once you've setup your Docker images/registry, you can configure GitLab CE to run various jobs in Docker containers. It's as easy as specifying the name of the image in an image field in gitlab-ci.yml. The images will run on an application called a Runner on a VM or bare metal. You can setup your own Runners in AWS/GCP/Azure or even on your own laptop, but GitLab CE also provides 2000 free pipeline-minutes per month hosted on GCP. Instructions for setting up GitLab Runners can be found at https://docs.gitlab.com/runner/.
Ansible Integration
Once you get your docker images/registry and runners set up, you can store the Ansible binaries and dependencies in the docker images. You can execute the playbooks from the script section of a job defined in gitlab-ci.yml. Using Ansible and GitLab a Infrastructure-for-Code. You can read some great tutorials here and here.

Setup Azure Pipelines for a Azure multi container app (multiple repositories)

I currently have a web app split into three parts. Each part has its own git repository.
Frontend Angular (foo.bar)
Backend Angular (foo.bar/admin)
.NET Core API (foo.bar/api)
In front sits an NGINX Server which acts as a reverse proxy. Currently, it all runs on a VM together with a Jenkins Server which allows me to develop and deploy each part separately, which I really like.
I would like to containerize the application and move it to Azure Web Service for Containers. For the CD/CI I would like to use Azure DevOps & Azure Pipelines. Since Azure Web Service for Containers supports multi-container via Docker Compose and Kubernetes.
The main question is:
How can I build and deploy one specific container (e.g. Azure/frontend:10) in the multi-container (via Docker Compose) environment? (Without building all the other containers)
If that is possible...
How do I set up the Azure Pipelines and Azure Container Registry to allow me separate container deployments
Where does the docker-compose file live? In a separate repository?
Where does the reverse proxy NGINX Dockerfile live? In a separate repository as well?
Or do I need to use Kubernetes?
Alternately I could use three different App Webs on the same Service Plan and control it per domain/sub-domain.
Frontend Angular (foo.bar)
Backend Angular (admin.foo.bar)
.NET Core API (api.foo.bar)
I don’t know where to start. It is a small project too. I don’t want to make it too complicated.
Any tip is more than welcome.
Thanks in advance!
I do not have experience with Azure Pipelines, but there are some ideas about Azure Container Registry and the Azure Web App for Container.
First, if you just want to build one specific container in the multi-container via Docker compose, you can just set this in the tutorial:
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
The compose also can be work with one container set in the file.
Second, the compose file can be everywhere that you run the command to create Web App for Container. For example, you can run the CLI command in your local machine with the compose file that store in your local machine.
Third, if you use Azure Web App for Container, you should prepare the docker image ready before in your repository, for example, the Azure Container Registry. It does not like docker compose installed in your local machine.
The AKS is also a good choice. You can create the service one by one or set them all in one yaml file. It's quite flexible.
Hope this will help you. If you need more help about the AKS or ACR please give the message.
You can use a container registry which will allow you to use docker to build each individual containers. You can then deploy a multi container app using containers from the container registry.
Building the container file follows the standard methods allowing you to copy configure and so forth. Once built you can push these by tagging them as follows: container_registry_name/container_name:{{.Run.ID}}
I would suggest based on the provided sample using a production database instead of a container as I have run into issues where a db data gets reset on container restart. Volumes for files can be persisted with the below:
${WEBAPP_STORAGE_HOME}/something/another:/var/www/html
Docker-Compose for containers does not (currently) allow you to use build in the azure pipeline as its meant for deployment only
One will need first build the dockerfiles and then reference your newly stored container registry images in docker-compose.yml. Also please take note that you cannot simply reference a docker hub image and a container registry image in the same compose file. You will need to pull and tag or build and tag the container to use it in that way. You can either use container registry images or public images.
In order to for your app to be able to connect to these images you need to add this to your app settings as well as allow admin in the container registry service:
DOCKER_REGISTRY_SERVER_USERNAME = [azure-container-registry-name]
DOCKER_REGISTRY_SERVER_URL = [azure-container-registry-name].azurecr.io
DOCKER_REGISTRY_SERVER_PASSWORD = [password]
Once you have your basic app setup you can then configure your continous integration options for further development such as webhooks, build options and so forth.

Run docker container on azure

I have a simple docker container which runs just fine on my local machine. I was hoping to find an easy checklist how I could publish and run my docker container on Azure, but couldn't find one. I only found https://docs.docker.com/docker-for-azure/, but this document kind of leaves me alone when it comes to actually copy my local docker container to Azure. Isn't that supposed to be very easy? Can anybody point me in the right direction how to do this?
But it is really easy.. once you know where to find the docs :-). I would take the azure docs as a starting point as there are multiple options when it comes to hosting containers in Azure:
If you're looking for this...
Simplify the deployment, management, and operations of Kubernetes -> Azure Container Service (AKS)
Easily run containers on Azure with a single command -> Container Instances
Store and manage container images across all types of Azure deployments
-> Container Registry
Develop microservices and orchestrate containers on Windows or Linux
-> Service Fabric
Deploy web applications on Linux using containers
-> App Service
Based on your info I would suggest storing the image using the Azure Container Registry and host the container using Azure Container Instances. No need for a VM to manage this way.
There is an excellent tutorial you could follow (I skipped the first 1 step since it involves creating a docker image, you already have one)
Another complete guide of pushing your image to azure and create a running container can be found here.
The good thing about Azure Container Instances is that you only pay for what you actually use. The Azure Container Registry is a private image repository hosted in Azure, if course you could also use Docker Hub but using ACR makes it all really simple.
In order to run an image, you simply need to configure a new VM with the Docker Daemon. I personally found Azure's documentation to be pretty complex. Assuming you are not trying to scale your service across instances, I would recommend using docker-machine rather than the Azure guide.
docker-machine is a CLI tool published by the Docker team which automatically installs the Docker Daemon (and all the dependencies) on a host. So all you would need to do is input your Azure subscription and it will automatically create a VM configured appropriately.
In terms of publishing the image, Azure is probably not the right solution. I would recommend one of two things:
Use Docker Hub, which serves as a free hosted Docker image repository. You can simply push images to Docker Hub (or even have them built directly from your Git repository).
Configure a CD tool, such as TravisCI or CircleCI, and use these to build your image and push directly to your deployment.
To run your docker image inside ACI, You can use of Azure Container Registry.
Step0: Create Azure Container Registry
Step1: Include a Dockerfile in your application code
Step2: Build the code along with the Dockerfile with a tag and create a
Docker image ( docker build -t imagename:tag .)
Step3: Push the Docker image to Azure container Registry with a image name and tag.
Step4: Now create a ACI, while creating, choose the image type as private, provide the image name, tag, image registry login server, image registry username, image registry password ( these details can be found under access keys tab inside Azure Container Registry)
Step5: choose running os as linux, in network step you can give an dns name for your ACI, then click on review & create
Step6: once ACI gets created you can go to overview and you can see fqdn, using fqdn you can access your application running inside Azure Container Instance.

Web App for Containers - Kudu omitting Docker Login

We use Web App for Containers to operate Docker containers hosted on our Azure registry. This web app has been configured to pull the latest changes from the registry which in turns has lead to the creation of the following env variables:
DOCKER_REGISTRY_SERVER_URL
DOCKER_REGISTRY_SERVER_USERNAME
DOCKER_REGISTRY_SERVER_PASSWORD
DOCKER_ENABLE_CI
All values are correct and in the first place the Docker based setup worked well for us. Since monday, however, Kudu is longer able to pull docker images from our registry (neither from any registry that requires auth at all). The Kudu log is:
docker pull returned STDERR>> Error response from daemon: Get OUR_REGISTRY: unauthorized: authentication required
which suggests that Kudu is omitting the required Docker login call. Has anyone observed the same behaviour or is aware of Azure changes that require any adoption form our site. Thanks!
What we have tried so far:
creating a new registry
creating a new web app
creating a new service plan
restarting/stopping the web apps

Resources