How to create a docker private registry in EC2 Instance? [closed] - docker

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I would like to know how to create a docker private registry in EC2 Instance?
Thanks in advance.

You should consider using managed solutions for docker registry to ensure scalability and availability like ECR, Dockerhub or Quay.io
However, if you still want to have your own private registry in EC2, here are the steps for the simplest setup:
Install docker inside the EC2. If you use AWS Linux AMI then docker is already installed.
Create a local directory to persist registry data
mkdir -p /opt/registry
Run the following command to spin up a private registry
docker run -d \
-p 5000:5000 \
--restart=always \
--name registry \
-v /opt/registry:/var/lib/registry \
registry:2
Update the security group for EC2 so that the registry can be accessed from outside at port 5000
Reference: Docker documentations
Note: There are a lot of things to consider before bringing your private registry to production like: security (encrypting traffic at rest and in transit), high-availability (what if the EC2 is being shut-down for any reason), etc.

Related

Can't ssh to GitLab ee in a docker container [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
I've installed GitLab ee on Docker. I'd like to use authentication via ssh instead password but each time I try to authenticate, connection is closed. SSH Port is 1122->22 so I'm connecting with git#gitlab.example -p 1122. I also enabled the port in ufw, checked if openssh server is running in the container.
Error: Connection closed by HOST port 1122
I was searching long time but I didn't find anything so I'll be glad for any suggestion.
Potential problem with Docker and UFW
Time ago I was wondering how to work with both UFW and Docker together (The GitLab service doesn't seem to be the problem, pretty sure you could have had the same problems with any service at all).
Check out this thread: What is the best practice of docker + ufw under Ubuntu
And also consider this:
To persist the iptables rule install the linux package iptables-persistent according to your server distro, in my case (Debian) is sudo apt install iptables-persistent and the package installation will add the NAT rule to a persistent file which is executed on boot. ~afboteros
Potential problem with Gitlab and Docker
When using Gitlab through Docker, some "heavy port-binded" services like SSH might need you to configure them to the exposed port. Maybe if you set the SSH service to the 1122 as you intended to, and binding it like that on the Dockerfile maybe you could make it work.
Official Gitlab documentation

Add Insecure Registry to Docker in ubuntu [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
I am trying to add private registry in docker on ubuntu machine, using nexus as repository
below is the screenshot of nexus configurations
in docker host i have added DOCKER_OPTS="--insecure-registry=xx.xx.xx.xx:8083" to /etc/default/docker
after these changes i did docker restart using below commands
systemctl daemon-reload
systemctl restart docker
now when i execute docker info its not showing up my private registry
is anything missing in my configurations
Try adding insecure registry entry in /etc/docker/daemon.json
file content
{ "insecure-registries":["registry.example.com"] }
restart the docker deamon
sudo systemctl restart docker

Why I can not simply ssh to docker container from my windows host? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I try to ssh from my windows host to a docker ubuntu container. I know, I can use docker exec -it <container-name> /bin/bash to launch, however, I want to do a normal "ssh root#192.168.xx.xx" to login because I want to simulate remote computer login and also it works also easily with my pycharm.
However, after I installed "openssh-server", and started it, the login with ssh from my host is still not possible.
:~$ ssh root#192.168.99.105
>>> The authenticity of host '192.168.99.105 (192.168.99.105)' can't be established.
ECDSA key fingerprint is SHA256:********
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.99.105' (ECDSA) to the list of known hosts.
root#192.168.99.105's password: xxx
Permission denied, please try again.
How can I solve this problem? I just want to simply ssh to this container...
To answer the question asked in the title:
Why I can not simply ssh to docker container from my windows host?
Docker is a way to configure Linux kernel settings on a process to limit what the process can see (namespaces) and how many resources that process can use (cgroups). So this question becomes "why can't I ssh into a process" and the answer is typically because that process is not an sshd server. The Ubuntu image for docker is not a virtual machine with all the associated daemons, it doesn't even include the kernel. Instead, it's a minimal filesystem with utilities found in a Ubuntu environment (like apt-get and bash).
On the other hand, the docker exec command does work because it is running a second command in the same isolated environment as the rest of the container. So if bash is installed in the image, then docker exec -it $container_id bash will run an interactive shell with the same namespaces and cgroups as the rest of your container processes.
If you want to ssh into your container, my advice is that you don't. This is similar to a code smell, a sign you are treating containers like a VM, and will have issues with the immutability and ephemeral nature of containers. The goal of working with containers is to have all your changes pushed into version control, build a new image, and deploy that image, for every change to the production environment. This eliminates the risk of state drift where interactive changes were made over time by one person and not known to the person trying to rebuild the environment later.
If you still prefer to ignore the advice, or your application is explicitly an sshd server, then you need to install and configure sshd as your running application inside of the container. There's documentation from Docker on how to do this, and lots of examples on Docker Hub from various individuals if you search on sshd (note that I don't believe any of these are official so I wouldn't recommend any of them).
You likely need to configure sshd on the container to allow root access and/or enable password authentication.
sudo sed -i 's|[#]*PasswordAuthentication no|PasswordAuthentication yes|g' /etc/ssh/sshd_config
echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config
sudo service sshd restart
One or both of these commands may help if you container image is ubuntu/debian based. I personally have never had the need to ssh into a docker container.

How to start Docker daemon on Ubuntu? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
On Windows, I've always been able to build Docker images with no problems.
I'm now trying to build a simple Docker image on Ubuntu 18.04 and typing in the terminal:
sudo docker build -t test .
results in the following error:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock.
Is the docker daemon running?
How do I start the Docker daemon? I want to be able to build the image successfully
EDIT:
Typing sudo systemctl start docker as stated in the original documentation https://docs.docker.com/config/daemon/systemd/ results in the following error:
Failed to start docker.service: Unit docker.service is masked.
You can configure docker to start on boot :
sudo systemctl enable docker
The ugly way : start docker manually :
dockerd &

Which OS for docker [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I bought a server for experimenting with docker. Now I need an OS, that docker can run on it. Which OS would you recommended to me? CoreOs, RancherOS, etc.
How about service discovery?
I want to run my microservices on container, that is my target.
Docker is compatible with Linux, Mac OS X, or Windows. I will prefer Linux as in Linux your machine will act as a localhost and the Docker host, in networking, localhost means your computer and the Docker client, the Docker daemon, and any containers run directly on your localhost while in Windows the docker daemon is running inside a Linux virtual machine. You will use the Windows Docker client to talk to the Docker host VM. Your Docker containers run inside this host.
Docker on Windows
Docker on Linux

Resources