Protocol for "docker pull" command - image

I am not sure what protocol does the "docker pull" or the "docker push " command use. When I try to access an image from a remote repository using the following convention
"docker pull http://my-repo/image-name:tag"
It fails with
http://my-repo/image-name:tag is not a valid repository/tag
But the following command runs with no issues
"docker pull my-repo/image-name:tag"
I have a requirement that I need the "http://"prefix in the repo-name. How can this be achieved?

Usage: docker pull [OPTIONS] NAME[:TAG] | [REGISTRY_HOST[:REGISTRY_PORT]/]NAME[:TAG]
According to this, docker uses https by default, unless your private repo allows otherwise.
In the same docs you'll find
A registry path is similar to a URL, but does not contain a protocol
specifier (https://).
Explicitly prefixing http:// on your docker pull command is not a valid syntax.

Related

Docker manifest unknown: Gitlab repository: Docker Desktop

I've been given a Docker image stored in the gitlab container registry, registry.gitlab.com.
I have a gitlab acount, with a password, and I am able to do a docker login:
docker login registry.gitlab.com
After I do that, I no longer get an authentication error when I try to do a docker command against that registry.
And the documentation for using that registry seems clear:
Go to your project or group’s Packages and registries > Container Registry and find the image you want.
Next to the image name, select Copy.
Use docker run with the image link:
docker run [options] registry.example.com/group/project/image [arguments]
https://docs.gitlab.com/ee/user/packages/container_registry/
But when I run any kind of docker command with the group/project/image I just copied, I just get the "manifest unknown" docker error, which normally indicates that the image is missing or mis-spelled.
So, maybe gitlab is broken, or maybe the gitlab documentation is wrong, or maybe there is something wrong with that particular image, or maybe it doesn't work using docker on WSL through Docker Desktop on Win10, or maybe ... I just haven't set up something correctly.
FWIW, Docker Desktop is a Windows service/application that proxies 'docker' commands in Windows, sending them to a docker instance running on WSL. It's normally transparent. It maintains a local registry, and seems to have some way of connecting to docker hub, but I've never used it with any other registry.
I'd like to pull that image into my local registry. What should I do different?

How to git push to a remote windows machine using ssh

When I try to push from a local repository to a remote windows machine, using the next command:
git push ssh://username#ip_address:/C/Users/username/project.git master
After entering credentials I get this error:
fatal: ''/c/Users/username/project.git'' does not appear to be a git
repository
fatal: Could not read from remote repository.
It seems like /C/Users/username/project.git must be replaced by C:/Users/username/project.git (without "/" before C) but when I try this variant, I get another error before asking for credentials:
ssh: Could not resolve hostname ip_address:C:: Name or service not
known
Any ':' in the SSH URL would make SSH interpret it as SCP syntax
An actual URI is as commented ssh://username#ip_address/C/Users/username/project.git
Make sure you check the case (lower/upercase) of the path used here.
Try also with /c/... vs /C/...

Building Docker container in Google Colab: unknown flag -t

I am trying to bring a github repo into my Google Colab workspace via the following code:
!git clone https://github.com/vanvalenlab/deepcell-tf.git
!cd deepcell-tf
!docker build -t $USER/deepcell-tf .
I have followed Google Colab's steps for install Docker (https://colab.research.google.com/drive/10OinT5ZNGtdLLQ9K399jlKgNgidxUbGP).
But when I run the above code, I get the following error:
invalid argument "/deepcell-tf" for "-t, --tag" flag: invalid reference format
See 'docker build --help'.
"-t" is a valid argument to pass according to the documentation. Why does it think I'm passing /deepcell-tf as an argument?
The -t is indeed a valid flag:
--tag , -t Name and optionally a tag in the name:tag format
The problem is that your $USER variable is not set, and your command is being interpreted as docker build -t /deepcell-tf ., which is an invalid form for naming the image.
You need to make sure to export the $USER value before running the docker build, or setting it manually to a valid value. E.g.:
docker build -t my-user/deepcell-tf .
The notebook you linked isn't actually published by Google, it was just made by another user.
Google Colab doesn't support Docker, and they currently have no plans to support it, unfortunately: https://github.com/googlecolab/colabtools/issues/299

How to use ssh key inside docker container

I am building dockerfile to create an image where I want to build a package. I want to pull this package inside the docker image. I need to do a git clone for that. I saw the discussion on this post :
Using SSH keys inside docker container
Based on that, here is the content in my Dockerfile :
ENV SSH_HOME /Users/myid
ADD $SSH_HOME/.ssh/id_rsa /root/.ssh/id_rsa
RUN echo " IdentityFile ~/.ssh/id_rsa" >> /etc/ssh/ssh_config
When I run docker build, I am getting an error due to relative path. If I provide absolute path, it says the location is outside of context. Any idea how to fix this? I am running on Mac OSX 10.
With the script above, I am getting the following error :
ADD failed: stat /var/lib/docker/tmp/docker-builder6164655/Users/myid/.ssh/id_rsa: no such file or directory
Looks like it might be related to this bug here
The broken example is very similar to your path problem:
# Dockerfile
FROM ubuntu:14.04
COPY start.sh /start.sh
# comes back with:
stat /var/lib/docker/aufs/mnt/e89417ccaafbc91c3f930b56819427f83b3f2d3b3a246fbd6b48c9abcc7233f6/start.sh: no such file or directory
I'd try
updating to the most recent docker
restarting your docker engine

How to stop git via ssh on windows from resolving the wrong path?

I have a windows 2003 box with an ssh server setup. I have msysgit (git version 1.6.2) installed both locally and on the server.
The server has the following absolute path to my repos:
e:\vc\git\myrepo.git
when a user logs in he/she will be put in the following working directory:
e:\vc\git\
When running the following cmd on my dev machine:
git clone ssh://myuser#myip/myrepo.git testrepo
I get the following error:
fatal: ''/myrepo.git'' does not appear to be a git repository
According to my ssh logs it appears that git is executing this cmd on the server:
'cmd.exe /c git-upload-pack '/myrepo.git''
Executing that command locally (on the server) fails for the same reason. I'm thinking the problem is related to git prefixing the path with a '/'. How do I tell git not to do this? Should this be working?
Note: git-upload-pack is working because I added \gitinstallpath\libexec\git-core to the path. Apparently this is a bug and will be fixed in the future, this was my work around.
I resolved this by switching my ssh server from winssh to openssh (via the cygwin layer). I was able to connect fine (as noted above) using winsshd, but winsshd wasn't correctly handling paths prefixed with "/". I could probably get winsshd to work, but switching to cygwin and openssh was faster.
Here's a good blog post to kick start the setup if your in a similar situation:
Have you tried the following?
git clone ssh://myuser#myip/myrepo testrepo
Note the removal of ".git" from the end of the SSH path. You only need that suffix at the end if the remote directory name has it.
Also, have you tried any other SSH URL format? To use a relative path, you can try:
git clone ssh://myuser#myip/~/myrepo testrepo
See the git clone man page for details on other URL formats.
If somebody still interested in workaround:
The problem is - cmd.exe doesn't understand single-quoted parameters. So we use sh instead.
Create file gup.sh with line
git-upload-pack.exe $*
and grp.sh with
git-receive-pack.exe $*
on server!
Then run:
git clone -u 'sh gup.sh' ssh://myuser#myip/e/vc/git/myrepo.git testrepo
git config remote.origin.uploadpack 'sh gup.sh'
git config remote.origin.receivepack 'sh grp.sh'

Resources