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.
Related
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
I want to make specifically a docker container that holds standard Docker Hub MySQL image.
Once this container is deployed using Azure Container services, how do I use it remotely?
I want to connect to this (container-hosted) mysql server remotely, so that my APIs can upload data to this database over internet.
Where do I find host,username, password for this hosted MySQL db?
Once this container is deployed using Azure Container services, how do
I use it remotely?
If you deploy the container to Azure Container Service, you can use a service with the LoadBalancer type to expose the port of the container to access outside.
Where do I find host,username, password for this hosted MySQL db?
You can use the environment variables to set the user and password. Except this, you can connect into the container, then go inside the MySQL and create the users manually.
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.
I'm using Tutum to host my application via docker. The first container needed is offical mysql container. I already got it up & running. After that, Tutum provide a service endpointfor me to connect to it:
However, I don't know how to connect to it via the provided endpoint (especially using Sequel Pro). Could anyone help me to figure this out?
As mentioned in "tutum support: Your first service", then endpoint is the url with port exposed by the image.
You would use it as an external client accessing to that url.
Note that you can set a port to be publish statically instead of dynamically (-p x:y instead of -P, in docker run lingo)
But in case of your containerized application, you don't need that endpoint.
Your container, if linked to the mysql container, you will be able to use mysql services from your app container directly.
See "Service discovery and links"
You don't have to use the full endpoint url from your app container.
Note that tutum:
provide a simple way to connect any container on any stack to any other container on your account without having to create service links.
A container can always discover other containers on the same stack using the container name as hostname.
I'm starting a debian jessie container from jessie like this:
systemd-nspawn --network-macvlan=eth0 -b -j -D /var/lib/container/debsid
The container get's an IPv4 from the gateway via DHCP, that's fine and also reaches servers outside. But I can't connect to the host and from the host the container's IP is not reachable. Any ideas on what is going wrong and which steps are missing?
(container created with debootstrap, just networkd is added to set the IP via DHCP)
You'll need to create a macvlan on the parent machine to allow for connectivity to the macvlans in your nspawn guests.
Take a look at the instructions here. http://web.archive.org/web/20190917181922/http://noyaudolive.net/2012/05/09/lxc-and-macvlan-host-to-guest-connection/