How to change power setting in a Docker container - docker

We can easily set different power modes in ubuntu by clicking on settings and then we can switch from Performance, Balanced, and Powersave modes.
My question is that, since docker environment is based on Ubuntu, can we do the same thing inside a docker, changing its power mode? Can I do this by running some commands? If I need to change a file in docker, where is it?
Any response is highly appreciated. Thanks a lot.

Related

Docker general configuration

For my personnal developping environement, I'm trying to learn docker and the best pratices for good configuration. But now I have à lot of question about how docker is working.
I'm on windows then I'm using hyper-v for running MobyLinuxVM, first I would like to know if it's possible to connect my-self to the VM to see what is inside and what is used for. Secondly I would like to know what this VM is used for? Is it for the deamon? Thirdly I would like to know where the daemon is set (wath is running) then what is the job of the service com.docker.service? Finaly is there a way by commande line to show the actual deamon ip and port and an example to show how the docker cli is connecting to?
Thanks, if someone is able to help me, because I'm a little bit lost.

Slowness in Docker container

I'm using docker for mac and curl command from docker container takes way longer than from my mac. Container is using default bridge network.
See below curl command from inside the container:
Command from mac:
Thanks.
It is a known issue that networking with bridge / nat mode in docker is slow. You could use hosted mode. This should be solved by the macvlan driver.
For further reference, please look at this bug.
This is known and solved in different ways, please see those benchmarks here: https://github.com/EugenMayer/docker-sync/wiki/4.-Performance
You also see, that the new :cached mount will not help with application performance, but can be used with docker-sync to speedup sync.
:delegated will help with application performance but will still take a while to land in d4m.
You can try using http://docker-sync.io with the native_osx strategy - it results in a speedup from 60-100 times faster, depending on your hardware performance and project size ( closer to 100 with bigger projects /and or worse hardware).
I am biased, so you want to look at the alternatives here https://github.com/EugenMayer/docker-sync/wiki/Alternatives-to-docker-sync - a detailed write up in what the difference is in strategies, you can look up here https://github.com/EugenMayer/docker-sync/wiki/8.-Strategies
One option is to switch to Docker machine. Docker machine doesn't have the problem like docker for mac.

how to set up a fast and light development environment using docker?

i have tried to learn some case like following:
https://github.com/ubermuda/docker-symfony
https://github.com/stage1/docker-php
but that above is not great for me. I need some post to tell me the complete process how to use docker with development.I have not problem with docker command such as docker-compose. Who have used docker as development environment? Give me some advice ,please.
thanks in advance.
What you are asking is MUCH too broad for it to be answerable in one reply.
I would start at the official Docker website, evaluate which images you might need (you can always build them yourself as well), and start putting your development environment together.
Docker

Is it possible/sane to develop within a container Docker

I'm new to Docker and was wondering if it was possible (and a good idea) to develop within a docker container.
I mean create a container, execute bash, install and configure everything I need and start developping inside the container.
The container becomes then my main machine (for CLI related works).
When I'm on the go (or when I buy a new machine), I can just push the container, and pull it on my laptop.
This sort the problem of having to keep and synchronize your dotfile.
I haven't started using docker yet, so is it something realistic or to avoid (spacke disk problem and/or pull/push timing issue).
Yes. It is a good idea, with the correct set-up. You'll be running code as if it was a virtual machine.
The Dockerfile configurations to create a build system is not polished and will not expand shell variables, so pre-installing applications may be a bit tedious. On the other hand after building your own image to create new users and working environment, it won't be necessary to build it again, plus you can mount your own file system with the -v parameter of the run command, so you can have the files you are going to need both in your host and container machine. It's versatile.
> sudo docker run -t -i -v
/home/user_name/Workspace/project:/home/user_name/Workspace/myproject <container-ID>
I'll play the contrarian and say it's a bad idea. I've done work where I've tried to keep a container "long running" and have modified it, but then accidentally lost it or deleted it.
In my opinion containers aren't meant to be long running VMs. They are just meant to be instances of an image. Start it, stop it, kill it, start it again.
As Alex mentioned, it's certainly possible, but in my opinion goes against the "Docker" way.
I'd rather use VirtualBox and Vagrant to create VMs to develop in.
Docker container for development can be very handy. Depending on your stack and preferred IDE you might want to keep the editing part outside, at host, and mount the directory with the sources from host to the container instead, as per Alex's suggestion. If you do so, beware potential performance issue on macos x with boot2docker.
I would not expect much from the workflow with pushing the images to sync between dev environments. IMHO keeping Dockerfiles together with the code and synching by SCM means is more straightforward direction to start with. I also carry supporting Makefiles to build image(s) / run container(s) same place.

Docker images with visual(X) support? Or should I use VBox instead in this case?

I am totally new to Docker and have only, so far, used the images available on Docker repos.
I have already tested and being using docker for some aspects of my daily activities and it works great for me but in some specific cases I need a "virtual" image of Linux with graphic support(X in Ubuntu or CentOS) and so far I have only encountered on Docker repos images that by default don't have X support.
Should I in this case use a standard Virtual Box or VMWare image? Is it possible to run a visual version of Linux in a docker container? I haven't tried it yet.
If you run your containers in privileged mode they can access the host's resources (and to anything else for that matter), so in essence it is possible though I'd be willing to bet that it turns out to be more trouble than it's worth because the containers won't be quite as portable as ones that don't require such outside resources.

Resources