Comments (9)
just do the same thing the Docker Quickstart Terminal shortcut does, but add whatever command to the end:
cd "C:\Program Files\Docker Toolbox"
"C:\Program Files\Git\bin\bash.exe" --login -i "C:\Program Files\Docker Toolbox\start.sh" docker run hello-world
from butterfly.
I would like to achieve the same thing.
from butterfly.
@novaterata thank you for the reply. This is quite helpful. Do you also have a quick tip about how to initiate a command inside VM after it is open? If I want to pass the command similar to what you proposed then we have to start the VM for every new command?
I ideally need to be able to communicate to VM once it's opened.
from butterfly.
http://stackoverflow.com/questions/26639968/boot2docker-startup-script-to-mount-local-shared-folder-with-host look at the accepted answer. It explains the location of a file that boot2docker will run when it starts. This could be your doorway so to speak. You could start a service of some kind here.
from butterfly.
@novaterata will do! thanks for the prompt reply.
from butterfly.
I don't know if that will work as I've kind of ignored windows docker since I deal with too many SMB shares. Good luck!
from butterfly.
Here is my findings so far:
OpenFOAM image is using boot2docker version 1.6.2. boot2docker was deprecated in favor of docker-machine and docker-for-Windows. Here is a useful subcommand comparison.
Nevertheless it is possible to use docker to run commands in a running container in Windows.
- Use
boot2docker shellinit
and set the environment based on the output. - Once environment is set. You can use
docker ps
to find container ID for OpenFOAM. Name of the container for the latest release is of_plus_300. - The
docker exec
command runs a new command in a running container. I can create a .sh file in study folder and then I can usedocker exec -it [container id] [command]
to run it.
The only issue here is that some of the OpenFOAM files and folders are not available to root user. In the newer versions exec -u
is available to change the username but not in version 1.6.2.
I tried a couple of solutions such as using sudo su to change the user inside the bash but so far I couldn't get it to work. There is a discussion here that suggests that I can re-create OpenFOAM's environment. I rather to just change the user if possible but if that can't happen then this can be the solution.
This post was very helpful.
from butterfly.
I think figured it out! This batch file runs the .sh in case folder that runs blockMesh and snappyHexMesh.
study_room.bat
cd "C:\Program Files\Boot2Docker for Windows"
set DOCKER_CERT_PATH=C:\Users\Administrator\.boot2docker\certs\boot2docker-vm
set DOCKER_TLS_VERIFY=1
set DOCKER_HOST=tcp://192.168.59.103:2376
docker exec -it 63915d16038d bash /home/ofuser/workingDir/butterfly/study_room/study_room.sh
study_room.sh
#!/bin/bash
su - ofuser -c "cd /home/ofuser/workingDir/butterfly/study_room_ver_3; blockMesh; snappyHexMesh"
from butterfly.
docker exec does the job. No need to extra .sh file.
@echo off
cd "C:\Program Files\Boot2Docker for Windows"
set DOCKER_CERT_PATH=C:\Users\Administrator\.boot2docker\certs\boot2docker-vm
set DOCKER_TLS_VERIFY=1
set DOCKER_HOST=tcp://192.168.59.103:2376
docker exec -it 63915d16038d su - ofuser -c "cd /home/ofuser/workingDir/butterfly/indoor_airflow; blockMesh | tee /home/ofuser/workingDir/butterfly/indoor_airflow/etc/blockMesh.log"
from butterfly.
Related Issues (20)
- Blockmeshcomponent error HOT 4
- Blockmesh Component Error HOT 2
- Butterfly<1.solution exception:windowserror. hep!help! HOT 1
- blockmesh :1.solution exception:windowserror. Who can help me!!! HOT 4
- Solution exception: WindowsError HOT 2
- Running time for Butterfly HOT 3
- Runtime error (UnauthorizedAccessException): Access to the path is denied
- butterfly doesn't seem to wake up blueCFD HOT 1
- Butterfly, Rhino, and BlueCore2020? HOT 6
- 1. Solution exception:WindowsError (wind analysis)
- Butterfly BlueCFD Installation. Followed instructions for both but still receiving error '1. Solution exception: Failed to import butterfly: No module named butterfly_grasshopper.timer'
- Blockmesh Component Error HOT 2
- Blockmesh Component Error HOT 2
- SnappyHexMesh Failed!
- 1. Solution exception:'"C:\Program Files\blueCFD-Core-2020\setvars.bat"' is not recognized as an internal or external command, operable program or batch file HOT 1
- Deleted
- Solution exception:Failed to find points file at C:\Users\An'd's\butterfly\outdoor_airflow\constant\polyMesh
- help,butterfly block mesh is warning HOT 4
- AddLayers output empty with True input in SnappyHexMesh HOT 2
- Moving or dynamic mesh
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from butterfly.