I am trying to test a simple lambda function using docker on windows.
I already have a docker lambcy/lambda image
But this line:
docker run --rm -v "$PWD":/var/task lambci/lambda
does not work on windows.
What is the appropiate way to do this?
docker run --rm -v "$PWD":/var/task lambci/lambda
The command that you running is targeting linux platform, as for windows platform maybe you can try below instead
docker run --rm -it -v %cd%:/var/task lambci/lambda
Related
I have a nodejs application inside a docker containter, and I'm trying to run another docker image from the container.
I connected the docker socket to the container, ran the machine, and I went into the containter.
docker run -it -v /var/run/docker.sock:/var/run/docker.sock -w /root node bash
When I write in the terminal docker I get an error:
bash: docker: command not found.
It happens precisely in the specific image of NodeJS, if for example I run such a test
docker run -v /var/run/docker.sock:/var/run/docker.sock \
-ti docker
It works great.
Why can't I run docker in the node image?
This not work because to mount sockets nodejs container must include a docker instance inside it.
Just try another general image other than docker. It also will not work. Search for nodejs images it self include docker. Use that then it will work.
If such image not exist you have to create new image from both docker and nodejs images and add command to start it.
I would like to run a GitLab Runner on Docker Desktop (I run a GitLab instance and a runner locally for testing purposes).
Unfornately, I could not find out how to map the Docker socket. The manual says one should use:
docker run -d --name gitlab-runner --restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
gitlab/gitlab-runner:latest
but apparently, this does not work on Windows. The information I found on StackOverflow seems to use older versions of Docker Desktop which use a Virtual Machine instead of WSL 2.
Can anybody tell me how to do the mapping on a "modern" Docker Desktop using WSL 2?
I am working on a jenkins ssh agent for my builds
I want to have docker installed so it can run and build docker images
I currently have the following in my Dockerfile
RUN curl -fsSL get.docker.com -o /opt/get-docker.sh
RUN chmod +x /opt/get-docker.sh
RUN sh /opt/get-docker.sh
This works fine when I run docker with
docker run <image> -v /var/run/docker.sock:/var/run/docker.sock
Issue I'm having is when I run docker ps with in the container, it shows all my parent containers as well, is there a way to prevent this?
If you mount the host's /var/run/docker.sock your docker client will connect to the host's docker daemon, and so see everything that is running on the host.
To make it so your containers can run docker in a way that appears isolated from the host you should investigate Docker-in-docker.
To get a node version - I expect to run the following:
node --version
I'm running the following with docker:
docker run node:4-onbuild -v
I get this:
docker: Error response from daemon: Container command '--version' not found or does not exist..
My question is: How to get version of node from docker container?
you need to specifically ask docker to run -v within the node container like below
docker run -it --rm node /bin/bash -c 'node --version'
I have a docker image build on Arch Linux (sailsjs-dev) with node and sailsjs which I would like to use for development, mounting the app directory inside the container as follows:
docker run --rm --name testapp -p 1337:1337 -v $PWD:/app \
sailsjs-dev sails lift
$PWD is the directory with the sails project.
This works fine on linux, but if I try to run it on macosx (with docker-machine) it hangs forever at the very beginning, with log level set on silly (in config/log.js):
info: Starting app...
There is no other output, this is all we get.
Note, the same docker image works perfectly also on mac with an express app. What could be peculiar of sail that causes the problem?
I can also add that on a mac docker uses a virtualbox instance named docker machine.
We solved it running npm install from within the docker container:
docker run --rm --name testapp -p 1337:1337 -ti -v $PWD:/app \
sailsjs-dev /bin/bash
npm install --no-bin-links
--no-bin-links avoids the creation of symlinks.