docker-compose run doesn't work in windows - windows

I am trying to figure out development with django and postgresql while using windows as the host OS. I followed 2 tutorials and both of them want me to run commands using docker-compose run, but it doesn't work on windows. It says:
> docker-compose.exe run web django-admin.py startproject rolesweb .
←[31mERROR←[0m: Interactive mode is not yet supported on Windows.
Please pass the -d flag when using `docker-compose run`.
Is there an alternative to this command? What should I do to be able to follow the tutorials further?
The tutorials:
https://docs.docker.com/compose/django/
https://realpython.com/blog/python/django-development-with-docker-compose-and-machine/

An alternative is to run docker-compose through a container where docker-compose is installed. That is what I initially recommended. In that context, the -d option would be supported.
docker-compose itself depends on nodejs/node-gyp which does not work well on Windows.

Related

Docker compose V2: unknown shorthand flag 'f' (windows)

I'm currently running docker desktop version 20.10.22 (build 3a2c30b, fresh install) on Windows (using wsl2), but docker compose commands with the -f flag do not work correctly. Since I'm using docker compose V2 (checked the option in the docker desktop settings), my commands are with a space instead of a hyphen. I get the following message when running any docker compose command using -f:
unknown shorthand flag: 'f' in -f See 'docker --help'.
Specifically, I'm running the FIWARE NGSI-LD tutorials. All docker compose commands that are used within those tutorials fail. The commands can be found in the services file for each tutorial. For example, a command that fails (saying that the -f flag does not exist) within the Short-Term-History tutorial is the following:
docker compose -f docker-compose/mintaka.yml -p fiware up -d --remove-orphans --renew-anon-volumes
The weird thing is that docker compose --help and docker compose --version both return the output from respectively docker --help and docker --version, as if it excludes the compose keyword. The output of the above command also refers to the standard docker help command instead of the docker compose help.
UPDATE: Docker excludes the compose keyword between docker and the rest of the command. Replacing compose with a random string of letters gives the same effect. It seems as if it cannot recognize the compose keyword.
The old docker-compose is not installed so that does not work either. Running which docker-compose returns the docker-compose.exe location, inside the .../Docker/resources/bin folder. Running which docker compose returns the location of docker.exe. The .../Docker/resources/bin folder is inside the path environment variable.
Does anybody know what the problem might be? I've searched countless websites but did not find any solutions for this problem yet.
Kind regards
Here is what I have in running processes when I run docker compose events:
Please check if you have all these directories and files. Then we can troubleshoot further.
I reinstalled docker desktop with the same installer (also same version) and this resolved the problem weirdly enough...
The only difference between my old and new installation was that I already had wsl2 installed this time.

Installing Laravel in Docker Container

Environment: Windows 11 + Docker Desktop 4.12.0
I've been digging this the entire morning. There doesn't seem to be a way of installing Laravel in a Docker image. You must curl it in your WSL2 distro. Trying the command curl -s https://laravel.build/example-app | bash in a Docker container command-line immediately returns the dreaded Docker is not running error message
Some suggest that I need to turn on my "WSL2 integration" checkbox in Docker Desktop settings, but that didn't help.
So what if I download the official Ubuntu image from Docker Hub, run it as a container. Can I download (curl) Laravel in that container?
And while we are here, how does the Bitnami Laravel image differ from the standard procedure given in Laravel documentation? I like it because I can download it as a normal Docker image and create as many containers as I want, but I'm unsure how this connects or contrasts with the official Laravel method.
If it helps anyone, the curl -s https://laravel.build/example-app | bash command downloads several Docker images including MariaDB, Redis, mailhog etc. and therefore needs Docker to be running on the host machine (which is not available inside a container, that's why you can't run the curl command there). Once downloaded, it creates a new container containing (no puns intended) one container for each of these images. You can also customize the list of images/containers that your Laravel application needs by passing the list of services in the curl command like this: curl -s https://laravel.build/example-app?with=mysql,redis. Thanks #apokryfos for the helpful comment. Once these containers are running, you can use VSCode (together with GIT) to connect to them and do your development work.
Of course, you can still use the old-school method of Laravel development. Just install XAMPP or one of its cousins on your machine and then use composer create-project command from the terminal to create it on your local file system. Then host your database and website on locally running instances of Apache and MariaDB.
I have yet to check out Bitnami Laravel image and how it works.

docker-compose command not available for mac

I installed docker with the instructions here, downloading from docker-hub
https://docs.docker.com/docker-for-mac/install/
But when I run docker-compose I get this error
pyenv: docker-compose: command not found
The `docker-compose' command exists in these Python versions:
3.6.5/envs/myenv
Also, docker-compose is available under /Users
which docker-compose
/Users/<username>/.pyenv/shims/docker-compose
In this link says, docker-compose for mac need not be installed explicitly as it is part of docker for desktop mac.
https://docs.docker.com/compose/install/
Is something wrong with my installation?
I ran into the same issue on macOS today. Turned out that you need to run the installed app once, it does some additional downloading and setup. That setup includes setting up your path variables.
docker-compose is a utility that is now a parameter in mac docker
so instead of docker-compose up, its now docker compose up
if you install docker from official website then docker-compose will come along with that for mac so need to either upgrade and documentation is present there.

Is it possible to install CNTK on a macbook?

It is possible to install Microsoft CNTK on a macbook? I have OS X El Capitan. The official Microsoft documentation at https://github.com/Microsoft/CNTK/wiki/Setup-CNTK-on-your-machine doesn't provide any information for mac users.
Thank you
As of June 2017, you can only run CNTK on OSX using Docker (which will run a Linux container)
Documentation from Microsoft is available here: https://learn.microsoft.com/en-us/cognitive-toolkit/CNTK-Docker-Containers
If you want to run the CPU version of CNTK (as opposed to a GPU enabled) you'll need to pull a particular version of the docker container. See: https://hub.docker.com/r/microsoft/cntk/
I recommend using the following for CPU CNTK:
docker pull microsoft/cntk:2.0-cpu-python3.5
Once you've pulled the container above, you can use Jupyter Notebooks to look at tutorials etc:
First, run the container:
docker run -d -p 8888:8888 --name cntk-jupyter-notebooks -t microsoft/cntk:2.0-cpu-python3.5
Then run this command:
docker exec -it cntk-jupyter-notebooks bash -c "source /cntk/activate-cntk && jupyter-notebook --no-browser --port=8888 --ip=0.0.0.0 --notebook-dir=/cntk/Tutorials --allow-root"
You'll want to access the shell to run CNTK commands. You can attach a bash shell using docker.
Get your container id
docker ps
Then attach a shell
docker exec -it <container_id> bash
While it might not be supported on Mac directly, you can always use a virtual machine to get around.
You can setup docker in your local environment.
https://docs.docker.com/docker-for-mac/
Follow its documentations on how to install on Docker
https://github.com/Microsoft/CNTK/wiki/CNTK-Docker-Containers
We currently support both Linux and Windows. Mac support is on our ToDo or would be interested in community contribution.
I'm currently building CNTK on a linux machine without root access, installing every dependency with linuxbrew (a fork of homebrew). So I think is possible to build on MacOS natively. You can try building it from source with CNTK linux manual to build from source. Let me know if you have any issue.

TensorFlow docker dev workflow on mac

There is an official guide on how to install it that doesn't say much about actually developing in it.
From what I understand, there is a quite big challenge in developing with Docker in general. Not to mention there could be deeper technical complications about going with it for TensorFlow, maybe mostly thanks to GPUs. So there is a lot of stuff to after pulling the docker image...
Does anyone have a step by step guide on how to get development going here?
You could mount a local directory to the docker container so that you can still use your preferred editor in osx. Here's a command to start the container with a mounted directory and run a command:
docker run --name tensorflow --rm -v /Users/me/Code/web/tensorflow_dev:/tensorflow_dev b.gcr.io/tensorflow/tensorflow /bin/sh -c 'cd /tensorflow_dev && python mnist.py'
-v will mount the local directory and the -c will run the specified command. So your flow might look like:
Edit python script in your favorite editor
Run the above command to excute your script
However, I actually use pycharm so that I can place breakpoints and run the python script interactively within the editor.
Hope this helps.

Resources