I have images in my docker-compose.yml file that I would like to pull when my CI Runner is executing the build.
Everytime I try I run into this:
Pulling web (registry.gitlab.com/xxxxx/xxxxx/crm:latest)...
Pulling repository registry.gitlab.com/xxxxx/xxxxx/crm
Error: image xxxxx/xxxxx/crm:latest not found
You have to login to the registry first
- docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY
To build on #llya-kuchaev answer the related gitlab docs are here: https://about.gitlab.com/2016/05/23/gitlab-container-registry/
Your version of gitlab might change the environment variables you need to use. In version 9+ use $CI_JOB_TOKEN in earlier versions use $CI_BUILD_TOKEN, see https://docs.gitlab.com/ee/ci/variables/ for all the changes that were made in v9 (there were loads)
Related
I've got laravel sail which as I know is few containers (mysql, redis, laravel, ...). Is there an easy way to just pack up the whole thing to ex. Docker Hub and easly download it on production server, and when i update it on localhost and run docker push, just run docker pull. Then everything (like new commands in DockerFile | apt install thing) will be updated and working exacly how it worked on localhost
I read the documentation, but I cannot figure out how docker works and how to easly change project location (Ex. I'm working on project at work, sometimes at home and this will be much easier to run docker push when I need build source code and deploy it)
I'm keeping source code on github, and it's working for dev servers, but to deploy something I have to check all dependencies and DockerFile, .env file and other things to make it works on production.
Thanks for help!
You can use the existing docker-compose.yml and just run docker-compose up -d on production to start all containers. Just be sure to for example disable xdebug on production as it slows down every request.
I've created a complete new Xamarin Forms App project in Visual Studio for Mac and added it to a GitLab repository. After that I created a .gitlab-ci.yml file for setting up my CI build. But the problem is that I get error messages:
error MSB4019: The imported project "/usr/lib/mono/xbuild/Xamarin/iOS/Xamarin.iOS.CSharp.targets" was not found. Confirm that the expression in the Import declaration "/usr/lib/mono/xbuild/Xamarin/iOS/Xamarin.iOS.CSharp.targets" is correct, and that the file exists on disk.
This error pops up also for Xamarin.Android.Csharp.targets.
My YML file look like this:
image: mono:latest
stages:
- build
build:
stage: build
before_script:
- msbuild -version
- 'echo BUILDING'
- 'echo NuGet Restore'
- nuget restore 'XamarinFormsTestApp.sln'
script:
- 'echo Cleaning'
- MONO_IOMAP=case msbuild 'XamarinFormsTestApp.sln' $BUILD_VERBOSITY /t:Clean /p:Configuration=Debug
Some help would be appreciated ;)
You will need a mac os host to build Xamarin.iOS application and AFAIK it's not there yet in GitLab. You can find the discussion here and private beta here. For now, I would recommend going your own MacOS Host and registered GitLab runner on that host:
https://docs.gitlab.com/runner/
You can set up the host where you want (VM or Physical device) and install the GitLab runner and Xamarin environment there, tag it and use with the GitLab pipelines as with any other shared runner.
From the comments on your question, it looks like Xamarin isn't available in the mono:latest image, but that's ok because you can create your own docker images to use in Gitlab CI. You will need to have access to a registry, but if you use gitlab.com (opposed to a self-hosted instance) the registry is enabled for all users. You can find more information on that in the docs: https://docs.gitlab.com/ee/user/packages/container_registry/
If you are using self-hosted, the registry is still available (even for free versions) but it has to be enabled by an admin (docs here: https://docs.gitlab.com/ee/administration/packages/container_registry.html).
Another option is to use Docker's own registry, Docker Hub. It doesn't matter what registry you use, but you'll have to have access to one of them so your runners can pull down your image. This is especially true if you're using shared runners that you (or your admins) don't have direct control over. If you can directly control your runners, another option is to build the docker image on all of your runners that need it.
I'm not familiar with Xaramin, but here's how you can create a new Docker image based on mono:latest:
# ./mono-xamarin/Dockerfile
FROM mono:latest # this lets us build off of an existing image rather than starting from scratch. Everything in the mono:latest image will be available in this image
RUN ./install_xamarin.sh # Run whatever you need to in order to install xamarin or anything else you need.
RUN apt-get install git # just an example
Once your Dockerfile is written, you can build it like this:
docker build --file path/to/Dockerfile --tag mono-xamarin:latest
If you build the image on your runners, you can use it immediately like:
# .gitlab-ci.yml
image: mono-xamarin:latest
stages:
- build
...
Otherwise you can now push it to whichever registry you want to use.
I have been trying to build a docker image for oracle/weblogic 12.2.1.
I followed all the instructions carefully as given in the official repo.
https://github.com/oracle/docker-images/tree/master/OracleWebLogic/dockerfiles/12.2.1.1
but when i run:
docker build -t oracle/weblogic:12.2.1.1-developer .
it gives me a permission denied error.
sudo docker build -t oracle/weblogic:12.2.1.1-developer .
Sending build context to Docker daemon 54.79MB
Step 1/13 : FROM oracle/serverjre:8
pull access denied for oracle/serverjre, repository does not exist or may require 'docker login'
can anyone please help me??
Thankyou
For some time now, it's needed not only to login with the Oracle account, but also to accept the license and user agreement. So you cannot do it only from command line. You must go to the Oracle container registry:
https://container-registry.oracle.com/
Then select Java repository, then select serverjre, then signin:
And accept the license:
Once you have done that, you'll be able to pull the docker image, but as other have said, you'll need to change the registry that is set inside the Dockerfile:
#FROM oracle/serverjre:8
FROM container-registry.oracle.com/java/serverjre:8
And afterwards, before running the build, you must do a docker login
docker login container-registry.oracle.com
username:<SSO USERNAME>
password:<SSO PASSWORD>
At this point, you'll be able to pull the image.
I followed the pattern used in the git hub project https://github.com/oracle/docker-images/tree/master/
If you checkout the project and go into the OracleJava directory and look at the *.download file (in this case for JRE 8: https://github.com/oracle/docker-images/blob/master/OracleJava/java-8/server-jre-8u151-linux-x64.tar.gz.download)
There is a link to download the tarball (after you accept the license agreement and sign in).
You can then place the tarball in the same directory as the build.sh (OracleJava/java-8).
Run: sh build.sh
This should then create the docker image of oracle/serverjre:8
You can should then be able to do your build and the instance of the image will be found locally.
If you're using a custom image with Dockerfile, Delete the oracle/ it's not your local repository.
Try docker build -t weblogic:12.2.1.1-developer .
Or just make a docker run [image]
I worked around the problem by having a docker image built for oracle/serverjre:8 in my machine.
I downloaded the oracle/Serverjre8 binaries and built a docker image then built the weblogic.And it worked !!
Alternately,you can pull the image for Oracle/ServerJre8 directly from Oracle container registry or Docker store by logging in first.
docker login container-registry.oracle.com
Username: <oracle sso="" username="">
Password: <oracle sso="" password="">
Login successful.
docker pull container-registry.oracle.com/java/serverjre:8
Considering WebLogic version 12.2.1.3, In case of PULL error and changing the registry to oracle registry, Below conditions should be checked-
While executing the script buildDockerImage.sh, make sure Dockerfile.developer (/docker-images/OracleWebLogic/dockerfiles/12.2.1.3/Dockerfile.developer) has entry to be changed-
#FROM oracle/serverjre:8
FROM container-registry.oracle.com/java/serverjre:8
User might need to be logged at oracle container registry for pull operation, so better is to login first prior to script execution.
docker login container-registry.oracle.com
username:<SSO USERNAME>
password:<SSO PASSWORD>
Also /docker-images/OracleWebLogic/dockerfiles/12.2.1.3/ contains fmw_12.2.1.3.0_wls_Disk1_1of1.zip.download file, that indicates necessary physical download of fmw_12.2.1.3.0_wls_Disk1_1of1.zip to be done from http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-for-dev-1703574.html and the same should be available at /docker-images/OracleWebLogic/dockerfiles/12.2.1.3/
Maybe when you created the Java image from OracleJava/8 you use the parameter version: 8-slim and with that image you try to create the weblogic image.
You just should use the version for default : Oracle Server JRE 8 on Oracle Linux 7 slim when create the OraclaJava image
build.sh for Oracle Java images
With that image of Java, you can create your weblogic image without problems, because that java image has tag: oracle/serverjre:8
echo "Building Oracle Server JRE 8 on Oracle Linux 7 slim"
docker build --tag oracle/serverjre:8 --tag oracle/serverjre:8-oraclelinux7 .
Our containers are hosted using Google Container Registry, and I am using id "com.bmuschko.docker-java-application" version "3.0.7" to build and deploy docker containers. However, I run into permission issues whenever I try to pull the base image or push the image to GCR (I am able to get to the latter step by pulling the image and having it available locally).
I'm a little bit confused by how I can properly configure a particular GCloud account to be used whenever issuing any Docker related calls over a wire using the plugin.
As a first attempt, I've tried to create a task that precedes and build or push commands:
task gcloudLogin(type:Exec) {
executable "gcloud"
args "auth", "activate-service-account", "--key-file", "$System.env.KEY_FILE"
}
However, this simple wrapper doesn't work as desired. Is there currently a supported way to have this plugin work with GCR?
Got in touch with the maintainers of the gradle docker plugin and we have found this to be a valid solution.
So, we have permissions setup on who can push to the docker registry in artifactory. Now, I created a dockercfg file in $HOME/.dockercfg on my mac and added the username and passing using the curl command:
curl -uaaaaa:bbbbbbb "https://docker.io/v2/auth" >> $HOME/.dockercfg
After that when I try to push an image to docker registry, it fails with the below error:
unauthorized: The client does not have permission to push to the repository.
When I look at the docker request.log in the registry, I see its trying to push as anonymous from my mac. This is very confusing. Even though I have the $HOME/.dockercfg which has a user.
I also tried the docker login docker.io way but that too isnt helping.
It seems that the artifactory docker registry isnt able to find the user info when I am pushing from my mac and shows as anonymous.
My artifactory server version is 4.5.0 and docker 1.12.0-rc2.
Can anybody please help.
To the best of my knowledge Docker 1.12 no longer supports configuration placed under ~/.dockercfg instead it should be placed under ~/.docker/config.json --> In any case the method you're using was relevant for the older docker clients, you should use docker login to authenticate your docker client with Artifactory.
As a side note, Your version of Artifactory is a bit old - newer versions have made significant changes to support the newer Docker versions so you should upgrade before trying again.
Also remember to configure your Reverse Proxy to work with Artifactory and that you also probably need to set up Docker (and your reverse proxy) to use self-signed certificates.