How can I allow insecure registries in Portainer? - portainer

I'm running a private container registry on my docker host. The same docker host is running Portainer and I would really like to keep using Portainer to manage my docker host.
But since I'm running a private container registry its only set up with http, and I need to configure the container client do allow http.
I've tried opening console on Portainer on the running Portainer container but It only "refreshes" the window.
I've puttyied in and tried to attach to the container but this only crashes the container.
Any clue on how to access the /etc/docker/daemon.json resource in the portainer instance?

Portainer interacts with the host's docker daemon, so edit (or create) the /etc/docker/daemon.json file on the host

Related

Host cannot communicate with app running inside LXC container

I am running on my personal machine with Ubuntu 18.04 multiple lxc containers. Each container has Ubuntu 18.04 as well. For each container I am running an application which offers a UI on https://localhost:3000/. Since every container has a local IP address in my network then I should be able to call forth the application UI on my host machine using https://:3000/ .
This doesn’t work. If I run Apache2 inside the containers, I can see the default page for http:// but nothing on the other application running on port 3000. I can confirm the app on port 3000 is working.
user#pc:~$ nc -zv 10.155.120.175 22
Connection to 10.155.120.175 22 port [tcp/ssh] succeeded!
user#pc:~$ nc -zv 10.155.120.175 3000
nc: connect to 10.155.120.175 port 3000 (tcp) failed: Connection refused
I also noticed that the application logs inside the VM contained this line, but I dont know what it means in the context of app health.
Nov 17 20:38:49 server systemd[1]: app.service: Failed to reset devices.list: Operation not permitted
How can I enable ip:port access between host and lxc vm (and between lxc vms)? I want my lxc instances to be able to communicate with each other and my main host, exchange data etc.But I cant even open the UI of an app running inside a container on my browser.
Edit:
When I enable ufw in the container not even the default apache2 webpage opens anymore. Once I disable ufw in the container apache2 page becomes accessible again via

When creating (not running) a docker, does assigning a container to a network have any real effect?

When i create a container (but not run it yet) by docker container create ... (not by docker run), if I include option --network my_network_name then when i run this docker, will the docker be connected to the network that i specified?
If you say 'no' then it means --network my_network_name does not have any real effect.
More specifically, if i create a container by:
docker container create --name mysql_container --network my_network mysql
then when i run it by:
docker container start -it mysql_container
will mysql_container be automatically connected to my_network?
from Docker. Docs
Network driversđź”—
Docker’s networking subsystem is pluggable, using drivers. Several drivers exist by default, and provide core networking functionality:
bridge: The default network driver. If you don’t specify a driver, this is the type of network you are creating. Bridge networks are usually used when your applications run in standalone containers that need to communicate. See bridge networks.
host: For standalone containers, remove network isolation between the container and the Docker host, and use the host’s networking directly. See use the host network.
overlay: Overlay networks connect multiple Docker daemons together and enable swarm services to communicate with each other. You can also use overlay networks to facilitate communication between a swarm service and a standalone container, or between two standalone containers on different Docker daemons. This strategy removes the need to do OS-level routing between these containers. See overlay networks.
macvlan: Macvlan networks allow you to assign a MAC address to a container, making it appear as a physical device on your network. The Docker daemon routes traffic to containers by their MAC addresses. Using the macvlan driver is sometimes the best choice when dealing with legacy applications that expect to be directly connected to the physical network, rather than routed through the Docker host’s network stack. See Macvlan networks.
none: For this container, disable all networking. Usually used in conjunction with a custom network driver. none is not available for swarm services. See disable container networking.
Network plugins: You can install and use third-party network plugins with Docker. These plugins are available from Docker Hub or from third-party vendors. See the vendor’s documentation for installing and using a given network plugin.

Restart Docker Containers in Sequence after Server Reboot

There are 3 docker containers that need to be restarted automatically whenever the server reboot.
We can start the containers using restart policies, such as
sudo docker run --restart=always -d your_image
but because one container is linked to another, they need to be started in sequence.
Questioin: Is there a way to automatically restart Docker containers in sequence?
Docker doesn't have an option for this, and doing so is an anti-pattern for microservices. Instead, each container should gracefully return errors when it's dependencies aren't available, or as a fall back, you can use something like a wait-for-it command in your container's entrypoint to wait for your dependencies to be available. I'd also recommend against using "links" and instead place all your services on their own docker network, letting the built in dns resolution handle service discovery for you.

Docker container can't be reached from another PC

I built a mysql docker container. It seems to work fine, however when I try to connect to it from a computer it wont connect to mysql. The computer is in the same lan and can connect via ssh so it's not a networking issue. I'm pretty sure it has something to do with the ports not being published or binded correctly. Any suggestions? Thank you!
The most likely suspects for your issue are:
Your host firewall is set to not allow connections to MySQL (port 3306). It may be published by docker but you aren't permitting connections from outside the host.
Your docker isn't publishing as part of the same network but rather as a sub-network (not likely since you can connect to ssh from the other computer)
Your mysql instance is not set up to listen to remote connections. Check your my.cnf to ensure that it is isn't listening to localhost:3306.

mysql docker container start with a fixed ip

hi I have a mysql container running as a service, and for other services connect it with a jdbc url, with a ip:port.
and for sometimes the server needs to reboot. and the ip addr of mysql container will change, for every service needs to connect to mysql, the jdbc url needs to be modified.
is there a way to 'docker start' a container with a fixed ip address?
I've tried --ip but it's not working
docker version 1.11.2
You can preset an IP to a container, but this must be done when you create the container (in the docker run).
https://docs.docker.com/engine/reference/run/
To preset an IP to a container you ahve to add the switch --ip="desired_ip_here" in the docker run
Also you can use tools like supervisord to manage you processes and restart services without stopping the container.