I can't connect Docker CLI to the remote Docker demon inside minikube.
I've done minikube delete and then minikube start --driver=hyperv but when I do & minikube -p minikube docker-env | Invoke-Expression it comes back with a weird error which is:
You: The term 'You' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Invoke-Expression: Cannot bind argument to parameter 'Command' because it is an empty string.
Invoke-Expression:
Line |
1 | & minikube -p minikube docker-env | Invoke-Expression
| ~~~~~~~~~~~~~~~~~
| The string is missing the terminator: '.
Can anybody help with this?
This is a community wiki answer posted for better visibility. Feel free to expand it.
As already discussed in the comments the solution is to use the minikube docker-env command:
minikube docker-env
Configure environment to use minikube’s Docker daemon
Synopsis
Sets up docker env variables; similar to $(docker-machine env).
minikube docker-env [flags]
Notice the --shell option:
--shell string Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh, bash, zsh], default is auto-detect
Related
I've run in detached mode docker-compose up.
I have then run docker-compose exec container_name command
and i had nothing, so I have then run docker-compose exec -it container_name bash to get the shell and i got nothing either.
I have tried these command but I have no output from the first command and i dont have access to the shell with the second command. Do you know how i can have output or access the shell?
I am under macos x catalina 10.15.7. I have tried to reboot but it's the same.
docker-compose build and docker-compose up are running correctly
note docker ps -a gives me the same container id as docker-compose without the #1 at the end (react-wagtail-blog_web_cont with docker ps -a and react-wagtail-blog_web_cont_1 with docker-compose ps).
I can access my react-wagtail-blog_web_cont container with docker exec -it react-wagtail-blog_web_cont bash...
Thank you
If you just want to see the normal log output you can use docker logs <container> where container is the container name or hash. To find that, just run docker ps
Also if you want to see the logs realtime as they come use `docker logs -f
See docs
I have installed monstache service and trying to run the command
monstache -f mongo-elastic.toml &
But getting the below error message
bash: monstache: command not found
How can start the monstache and check the service status on AWS linux machine
try to give exact path of both location
something like this : /opt/monstache/build/linux-amd64/monstache -f /opt/monstache/mongo-elastic.toml &
When I start confluent local start I get /users/myusername/.confluent/config.json: No such file or directory.
Does anyone have any idea how to solve this?
you need to create the .confluent directory
1)Install the Confluent CLI, confluent, using the following script. The parameter must be in your PATH (e.g. /usr/local/bin).
On Microsoft Windows, an appropriate Linux environment may need to be installed in order to have the curl and sh commands available, such as the Windows Subsystem for Linux https://learn.microsoft.com/en-us/windows/wsl/about.
curl -L --http1.1 https://cnfl.io/cli | sh -s -- -b /path-to-cli
and then go to the path-to-cli folder and run below command
./confluent local start
I'm experiencing unexpected behavior using acbuild run. To get used to rkt the idea was to start with a CentOS7 based container running a SSH host. The bare CentOS 7 container referenced below as centos7.aci was created on a up-to-date CentOS7 install using the instructions given here.
The script used to build the SSHd ACI is
#! /bin/bash
acbuild begin ./centos7.aci
acbuild run -- yum install -y openssh-server
acbuild run -- mkdir /var/run/sshd
acbuild run -- sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
acbuild run -- sed 's#session\s*required\s*pam_loginuid.so#session optional pam_loginuid.so#g' -i /etc/pam.d/sshd
acbuild run -- ssh-keygen -A -C "" -N "" -q
acbuild run -- echo 'root:screencast' | chpasswd
acbuild set-name centos7-sshd
acbuild set-exec -- /usr/sbin/sshd -D
acbuild port add ssh tcp 22
acbuild write --overwrite centos7-sshd.aci
acbuild end
When it's spinned up using rkt run --insecure-options=image ./centos7-sshd.aci
the server runs but connection attempts fail because the password is not accepted. If I use rkt enter to get into the running container and re-run echo 'root:screencast' | chpasswd inside, I can login. So that acbuild run instruction has just not worked for some reason... To test a bit more, I replaced it by
acbuild run -- mkdir ~/.ssh
acbuild run -- echo "<rkt host SSH public key>“ >> ~/.ssh/authorized_keys
to enable key based instead of password login. It doesn't work: the key is refused. The reason is obvious once you look into the container: there's no authorized_keys file in ~/.ssh/. If I add a
acbuild run -- touch ~/.ssh/authorized_keys instruction before the key appending attempt, the file is created but it's still empty. So again a acbuild run instruction didn't work - without error notice. May it be related to the fact that both „ignored“ instructions use operators like >> and | ? All commands shown in the examples I've seen don't use any such operators yet the docs don't mention anything and a Google search doesn't help either. In dockerfile RUN instructions they also work fine... what is going wrong here?
P.S.: I tried to use the chroot instead of the default systemd-nspawn engine in the „ignored“ acbuild run instructions => same results
P.P.S.: there's no acbuild tag yet on StackOverflow so I had to tag this as rkt - could somebody with enough reputation create one please? Thx
Ok, I understood what happens using the the acbuild run --debug option.
When
acbuild run -- echo 'root:screencast' | chpasswd
gets executed it returns Running: [echo root:screencast] , the pipe is executed on the host machine. To get the intended result it should be
acbuild run -- /bin/sh -c "echo 'root:screencast' | chpasswd"
or in generic form
acbuild run -- /bin/sh -c "<cmd with pipes>"
as explained here
I would like to run a container on Windows 10 and mount my local folder to a folder in the container. Let's take the following command as an example, but any container will do.
docker run -v "$(pwd)":/data -- name mongo -d mongo mongod --smallfiles
The issue is with the pwd command. In a Unix environment it returns a relative path, but in Windows it returns an absolute path.
I have tried replacing "$(pwd)" with "." or even "./" with no luck. I also tried ($pwd | Resolve-Path -Relative). In all cases I get
Error parsing reference: ":/data" is not a valid repository/tag.
What works is replacing "$(pwd)" with /d/path/to/my/folder.
docker run -v /d/path/to/my/folder:/data -- name mongo -d mongo mongod --smallfiles
(which is d:\path\to\my\folder) and the mounting is done correctly. However, I'd like to make the command generic, so it can be run from any folder on the host.
This works in PowerShell:
docker run --rm -v ${PWD}:/data alpine ls /data
See Mount current directory as a volume in Docker on Windows 10.
As documented /<drive>/<path> is the correct syntax for mounting folders:
On Windows, mount directories using:
docker run -v /c/Users/<path>:/<container path> ...
You can make your command more generic by transforming a path to what Docker expects:
$PWD.Path -replace '^|\\+','/' -replace ':'
like this:
docker run -v "$($PWD.Path -replace '^|\\+','/' -replace ':')":/data -- ...
If the drive letter must be lowercased (can't test, since I don't have Docker running on Windows) it gets a little more complicated. If you can lowercase the entire string you could replace $PWD.Path with $PWD.Path.ToLower(). If you must lowercase just the drive letter and preserve case in the rest of the path you could use a callback function:
$re = [regex]'^([A-Z]):'
$cb = { $args[0].Groups[1].Value.ToLower() }
docker run -v "$($re.Replace($PWD.Path, $cb) -replace '^|\\+','/')":/data -- ...