I'm using dockerode to manage docker by the remote api. Everything works fine except that I can't figure how to set the environnement when I create the container.
The docker doc doesn't give any information about the Env post parameter format.
I tried {Env: ["foo=bar","fii:boo"], ... } {Env: {"foo":"bar","fii":"boo"}, ... } without success.
Does anyone know how to achieve this ?
The correct format is like:
"Env":["KEY=value", "ANOTHER=value"]
If it isn't working for you there is probably another issue there.
Related
I'm new to Docker, and I'm not sure how to quite deal with this situation.
So I'm trying to run a docker container in order to replicate some results from a research paper, specifically from here: https://github.com/danhper/bigcode-tools/blob/master/doc/tutorial.md
(image link: https://hub.docker.com/r/tuvistavie/bigcode-tools/).
I'm using a windows machine, and every time I try to run the docker image (via: docker run -p 80:80 tuvistavie/bigcode-tools), it instantly closes. I've tried running other images, such as the getting-started, but that image doesn't close instantly.
I've looked at some other potential workarounds, like using -dit, but since the instructions require setting an alias/doskey for a docker run command, using the alias and chaining it with other commands multiple times results in creating a queue for the docker container since the port is tied to the alias.
Like in the instructions from the GitHub link, I'm trying to set an alias/doskey to make api calls to pull data, but I am unable to get any data nor am I getting any errors when performing the calls on the command prompt.
Sorry for the long question, and thank you for your time!
Going in order of the instructions:
0. I can run this, it added the image to my Docker Desktop
1.
Since I'm using a windows machine, I had to use 'set' instead of 'export'
I'm not exactly sure what the $ is meant for in UNIX, and whether or not it has significant meaning, but from my understanding, the whole purpose is to create a directory named 'bigcode-workspace'
Instead of 'alias,' I needed to use doskey.
Since -dit prevented my image from instantly closing, I added that in as well, but I'm not 100% sure what it means. Running docker run (...) resulted in the docker image instantly closing.
When it came to using the doskey alias + another command, I've tried:
(doskey macro) (another command)
(doskey macro) ^& (another command)
(doskey macro) $T (another command)
This also seemed to be using github api call, so I also added a --token=(github_token), but that didn't change anything either
Because the later steps require expected data pulled from here, I am unable to progress any further.
Looks like this image is designed to be used as a command-line utility. So it should not be running continuously, but you run it via alias docker-bigcode for your tasks.
$BIGCODE_WORKSPACE is an environment variable expansion here. So on a Windows machine it's %BIGCODE_WORKSPACE%. You might want to set this variable in Settings->System->About->Advanced System Settings, because variables set with SET command will apply to the current command prompt session only. Or you can specify the path directly, without environment variable.
As for alias then I would just create a batch file with the following content:
docker run -p 6006:6006 -v %BIGCODE_WORKSPACE%:/bigcode-tools/workspace tuvistavie/bigcode-tools %*
This will run the specified command appending the batch file parameters at the end. You might need to add double quotes if BIGCODE_WORKSPACE path contains spaces.
I am new to Docker and trying to create a Payara image for my application.
In that, I need to set a bunch of custom system-properties as server configs...like I have them in my Payara domain.xml:
<configs>
<config name="server-config">
<system-property name="com.myorg.config.propertyA" value="abc"></system-property>
<system-property name="com.myorg.config.propertyB" value="def"></system-property>
.....
......
.......
So far, the Dockerfile I wrote, is like this.
I am trying to set just one system-property as of now, to experiment with ..and it's not working:
FROM payara/server-full
COPY myapp.war $DEPLOY_DIR
RUN echo 'set configs.config.server-config.system-property.com.myorg.config.propertyA=abc' > $POSTBOOT_COMMANDS
If I look at the post-boot-commands.asadmin inside the running container, it looks like this:
set configs.config.server-config.system-property.com.myorg.config.propertyA=abc
deploy /opt/payara/deployments/myapp.war
My application WAR ultimately fails to deploy due to being unable to find the property 'com.myorg.config.propertyA'.
I think I am trying to set the system property in the wrong way. Can anybody please advise? TIA
I found this works in the Dockerfile.
(So, I was trying to set it the wrong way initially).
RUN echo 'create-system-properties com.myorg.config.propertyA=abc' > $POSTBOOT_COMMANDS
I am trying to connect to a docker container on a remote host, and I followed the instructions at https://code.visualstudio.com/remote/advancedcontainers/develop-remote-host#_converting-an-existing-or-predefined-devcontainerjson by using devcontainer.json like:
{
...
"workspaceFolder": "/workspace",
"workspaceMount": "source=/path/to/host/dir,target=/workspace,type=bind,consistency=cached",
...
}
but I got an error saying: Property workspaceMount is not allowed.
Did some Googling and could not find any site explains this same exact issue.
What is wrong for this? I didn't change any settings of the extension, and I am able to connect to the container and run bash shell in it when start terminal after connection.
Its just this workspaceMount does not work.
Im deploy phx app using docker, running --remsh command from within the same container.
But it return could not contact remote node.
Anybody know the solution ?
Here is the snapshot
You seem to start the application as :nonode#nohost. To connect to it, you should have it started with either a short or fully qualified name.
mix release.init creates rel folder with two template files in it. Check env.sh.eex and make sure you start a release with a short name given. This should work:
export RELEASE_DISTRIBUTION=sname
export RELEASE_NODE=<%= #release.name %>
Sidenote: please post everything as plain text, not as images.
There is a problem in your command, please use --cookie instead of -cookie
I am using Jupyterhub 0.9.4 with DockerSpawner.
My goal is to pass every container spawned by the Spawner an additional host name, so make an additional entry in /etc/hosts.
I first tried via my docker-compose.yml file, which does not work, as the container are created by Jupyterhub.
I also tried it in the Dockerfile itself, but there it got overwritten.
I further tried it with changes in the jupyterhub_config.py file, by adding:
c.DockerSpawner.extra_create_kwargs.update({'command': '--add-host="<ip-address> <hostname>"'})
Still I do not see an entry in the /etc/hosts file in the container.
Anyone has a clue where I have to add it?
Thanks,
Max
You can do the equivalent of docker run --add-host "foo.domain.local:192.168.1.12" ... like so:
c.DockerSpawner.extra_host_config.update({
"extra_hosts": {
"foo.domain.local":"192.168.1.12",
"other.domain.local":"192.168.1.13"
}
})
I couldn't find that in any documentation.