how to copy docker images from nexus docker repo to aws ecr in jenkins pipeline - nexus

I have requirement to copy all nexus images to aws ece but not sure how to do it
how to copy docker images from nexus docker repo to aws ecr in jenkins pipeline

I would assume that the easiest option would be to pull the image from the nexus , retag and push.
Let's say you have docker-nexus.example.com as your docker nexus repo.
The AWS ECR has it's own unique DNS which can't be hidden behind DNS unless with NGINX proxy and even there i read are some issues but for easier understanding let's call it a docker-ecr.aws.amazon.com
And use the docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
So what you would do is
docker pull docker-nexus.example.com/application1:version1
docker tag docker-nexus.example.com/application1:version1 docker-ecr.aws.amazon.com/application1:version1
docker push docker-ecr.aws.amazon.com/application1:version1
And repeat cross all images.

Related

HTTP 403 Forbidden url error when access to docker container IIS setting server

Image of success call the swagger inside of the docker container
I success to start the Server in the docker container.
With the simple image of the Docker file, I install the dotnet sdk and hosting bundle, and set the IIS with command line.
I success to start the API Server with IIS and check with using curl inside of the docker container.
(Image is attached)
But, when I tried to call the outside from docker container, for example in my laptop, the only response is 403 Fordden url comes out.
HTTP 403 forbidden url error
I tried to compare with my local IIS setting, but every setting is exactly same.
No Managed code, and the Advance setting is same.
What's the problem?
This is the docker file I use.
# escape=`
FROM mcr.microsoft.com/windows/servercore:ltsc2019
SHELL ["powershell", "-Command"]
RUN Install-WindowsFeature Web-ASP
ADD https://download.microsoft.com/download/1/2/8/128E2E22-C1B9-44A4-BE2A-5859ED1D4592/rewrite_amd64_en-US.msi rewrite_amd64_en-US.msi
RUN Write-Host 'Installing URL Rewrite' ; Start-Process msiexec.exe -ArgumentList '/i', 'rewrite_amd64_en-US.msi', '/quiet', '/norestart' -NoNewWindow -Wait;
WORKDIR /app
COPY ./ /app
RUN mkdir C:/inetpub/wwwroot/api
COPY ./api C:/inetpub/wwwroot/api
EXPOSE 8080
and I install the dotnet-sdk3.1, dotnet-hosting-6.0.4
Please give me some advice.
Thanks in advance
I'm trying to containerize my server made with window and dotnet 3.1
But I got problem while I tried to access to exposed port.
By default, when you create or run a container using docker create or
docker run, it does not publish any of its ports to the outside world.
To make a port available to services outside of Docker, or to Docker
containers which are not connected to the container’s network, use the
--publish or -p flag. This creates a firewall rule which maps a container port to a port on the Docker host to the outside world.
For more information about container networking, please refer to this manual: https://docs.docker.com/config/containers/container-networking/

Centos7: docker swarm services cannot communicate over Overlay network

I have a swarm with 3 CentOS7 nodes running on openstack.
I created an overlay network with
docker network create --driver overlay p3net_test
Then I create 2 services named "nexus" and "nginx_nexus"
docker service create --name nexus --network p3net_test sonatype/docker-nexus3
docker service create -p 80:80 -p 443:443 --name nginx_nexus --network p3net_test nginx-img
I find that the inter container communication does not work. I am trying to use nginx as reverse proxy for nexus repo and I have tested it without swarm. Here is my nginx.conf file where I set upstream to nexus. The VIP does not get resolved. My containers cannot talk to each other.
Current update:I saw that CentOS7 uses 3.10 kernel and there are some issues with kernel version lower than 3.16 and overlay networks. Will try updating the kernel.

Running Jenkins in a Docker Container

Im trying to get some hands on experience in Jenkins and wanted to run it in a docker container. I was following the tutorial here. I have docker installed on my machine and using Kitematic I launched the official Jenkins docker image (tag: latest) using:
docker run -p 8080:8080 jenkins
However once the container is setup when I go to 192.168.99.100:8080 (192.168.99.100 is my docker-machine ip) it shows the default nginx page. 192.168.99.100:8080/jenkins shows
HTTP ERROR 404
Problem accessing /jenkins. Reason:
Not Found
The weird part is that kitmatic shows a web preview of the running container and shows jenkins up and running fine, but how do I access it via the browser????
EDIT : Just tried docker run -p 8082:8080 jenkins. and it works i.e. I can see the jenkins landing page. Whaaaa.. ?
See if the port 8080 is already taken by another application. it's not allocating this port because it's taken - that is why it can't reach Jenkins. try looking here: https://www.cyberciti.biz/tips/linux-display-open-ports-owner.html

Docker Container to Host Routing

I need a better up-to-date solution the following problem:
Problem: I have to manually create an iptable rule in order to allow a route from a dynamically docker bridge to the host. Otherwise container a cannot connect to container b because there is by default no route from a docker network to the docker host itself.
I have the following setup:
container-nginx (docker)
|
|-container-jira (docker) (https://jira.example.com)
|-container-confluence (docker) (https://confluence.example.com)
In order to have properly functioning Atlassian application links between Jira and Confluence:
Jira accesses Confluence over https://confluence.example.com
Confluence accesses Jira over https://jira.example.com
I use docker-compose for the whole setup and all container are inside the same network. By default this will not work i will get "no route to host" in both containers for hosts confluence.example.com and jira.example.com. Because every container inside the docker network have no route to the docker host itself.
Currently, each time the setup is initialized I manually create an iptable rule from the dynamically created docker bridge with id "br-wejfiweji" to the host.
This is cumbersome, is there "a new way" or "better way" to do this in Docker 1.11.x?
docker-compose version 2 does create a network which allows all containers to see each other. See "Networking in Compose" (since docker 1.10)
If your containers are created with the right hostname, that is jira.example.com and confluence.example.com (see docker-compose.yml hostname directive), nginx can proxy-pass directly to jira.example.com and confluence.example.com.
Those two hostname will resolve to the right IP address within the network created by docker-compose for those 3 (nginx, jira and confluence) containers.
I suggest in the comment to use an alias in order for jira to see confluence as nginx (nginx being aliases to confluence), in order for jira to always use nginx when accessing confluence.
version: '2'
services:
# HTTPS-ReverseProxy
nginx:
image: blacklabelops/nginx
container_name: nginx
networks:
default:
aliases:
- 'crucible.example.com'
- 'confluence.example.com'
- 'crowd.example.com'
- 'bitbucket.example.com'
- 'jira.example.com'
ports:
- '443:443'

docker registry with nginx: no such host

Here I setup two ubuntu machine which had run as docker registry. I just use the Docker Registry latest Image. Then I setup a ubuntu machine running Nginx which will proxy the request to either of the registries.
I changed the Nginx configuration file so I can see "/Docker registry server/" when I "curl" the Nginx server.
But things has been strange when I want to push my Image.
"dial tcp: docker-registry: no such host
Because I setup 3 docker containers on 3 different hosts. Layers of one images maybe post to different registries.

Resources