I had ChirpStack Docker-Compose container in my local Windows 10 PC. It was configured and running fine.
I did stupid thing. I was trying to make this system run on Azure by entering commands:
docker login azure
docker context create aci myacicontext
and some more ..
Finally I failed with Azure and now I would like my local docker run again by entering old good command that worked fine before Azure:
docker-compose up
Got error:
The platform targeted with the current context is not supported.
Make sure the context in use targets a Docker Engine.
I suppose this error is because I was loged in Azure and I executed command:
docker logout
But this not helped. How get my docker composer run on my Windows machine again?
I faced same issue and way to solve was to change context back to default
docker context use default
Related
Im attempting to publish a docker compose file to Amazon ECS using the new docker compose up and an ecs context (using security tokens) however i'm getting a blank output in the console.
C:\Repos\Project>docker compose -f docker-compose-up.yaml up
C:\Repos\Project>docker compose ps
C:\Repos\Project>docker compose version
Docker Compose version dev
C:\Repos\Project>docker login
Authenticating with existing credentials...
Login Succeeded
Logging in with your password grants your terminal complete access to your account.
For better security, log in with a limited-privilege personal access token. Learn more at https://docs.docker.com/go/access-tokens/
When i run the above against the default context it works as expected. Its just when im using the ecs context.
Does anyone have any ideas?
Thanks in advance
Environment
Windows version and build Version 2004 (OS Build 19037.1)
Docker Edge version 2.1.6.1
Ubuntu 18.04 on WSL 2
Current setup and status:
docker installed on windows
created aliases for docker, docker-compose, docker-credential-desktop, etc ...
Running commands such as docker build, docker ps, docker pull, docker images all work fine. Now I would like push an image and so of course I have to login first.
Problem: logging into docker hub.
I run docker login in the WSL terminal
I put in my username and password
I get the following error
Error saving credentials: error storing credentials - err: exec: "docker-credential-desktop": executable file not found in %PATH
%, out: ``
What I've tried so far
docker login from powershell works fine. So I created a symbolic link between /mnt/c/Users/<winusername>/.docker and /home/<wslusername>/.docker. The equivalent works fine for .aws, but for .docker it was not able to share or even acknowledge the credentials, so it asked again for the user and password and threw the same error as above.
This worked for me,
sudo ln -s /mnt/c/Program\ Files/Docker/Docker/resources/bin/docker-credential-desktop.exe /usr/bin/docker-credential-desktop.exe
Linking the executable from windows path to linux path or you can add the windows PATH on you linux PATH.
Refer: https://github.com/docker/for-win/issues/6652
Update Feb 2021
This is all much simpler now. If you are using WSL2 on a recent release of Windows, just install docker on the Windows side and ensure to configurations:
In General: us the WSL 2 based engine
In Resource/WSL Integration: enable integration with your default WSL distro
You will have to restart docker. Once it is done, everything works transparently.
Below here can be ignored
It turns out that the integration between Docker and WSL is better than I thought. Though it could have been better documented. I was going to change tack and try to install docker in the WSL. So I got rid of all the aliases and restarted my session. Lo and behold, when I ran docker there was still something running.
This is because the edge version of docker create the appropriate symbolic links and now I login into docker hub without any problem.
I have Docker installed inside a Virtual Machine with Windows Server 2016.
I have a Linux Container from Python3 with NGINX server using --restart=always param, it runs fine while I am logged in, if I restart the VM, the container is no longer active, and it starts only if I log in.
Also if I logout, the container stops.
How can I make a container run as a service without login and keep it running on logout?
I've got a better answer from HERE
The summary is to build a Task and assign it to Task Scheduler to run on Windows start.
All the scripts should be run on powershell
Logon to the windows server/machine where you want the Docker services to start automatically.
Create a file called startDocker.ps1 at your location of choice and save the following script inside it:
start-service -Name com.docker.service
start C:\'Program Files'\Docker\Docker\'Docker Desktop.exe'
Verify that the location of Docker.exe is correct on your machine otherwise modify it in the script accordingly.
Create a file called registerTask.ps1 and save the following script inside it.
$trigger = New-ScheduledTaskTrigger -AtStartup
$action = New-ScheduledTaskAction -Execute "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -Argument "-File C:\PowershellScripts\startDocker.ps1"
$settings = New-ScheduledTaskSettingsSet -Compatibility Win8 -AllowStartIfOnBatteries
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "Start Docker on Start up" -Settings $settings -User "Your user" -Password "Your user password" -RunLevel Highest
This is needed so that this user has access to docker services
try
{
Add-LocalGroupMember -Group docker-users -Member "Your user" -ErrorAction Stop
}
catch [Microsoft.PowerShell.Commands.MemberExistsException] { }
Modify the script: You will have to change a couple of things in the scripts above according to your computer/server.
In the $action line, change the location of startdocker.ps1 script file to where you have placed this file.
In the Register-ScheduledTask line change the account user and password to an account user that needs Docker services to be started at the Windows start-up.
Execute registerTask.ps1
Open Windows Powershell as Administrator and set the current directory to where you have placed registerTask.ps1. For example
cd C:\PewershellScripts\
Next execute this script as follows
.\PowershellScripts\
Since I went through quite a lot of pain in order to make this work, here is a solution that worked for me for running a linux container using docker desktop on a windows 10 VM.
First, read this page to understand a method for running a python script as a windows service.
Then run your container using powershell and give it a name e.g
docker run --name app your_container
In the script you run as a service, e.g the main method of your winservice class, use subprocess.call(['powershell.exe', 'path/to/docker desktop.exe]) to start docker desktop in the service. Then wait for docker to start. I did this by using the docker SDK:
client = docker.from_env()
started = False
while not started:
try:
info = client.info()
started = True
except:
time.sleep(1)
When client has started, run your app with subprocess again
subprocess.call(['powershell.exe', 'docker start -interactive app'])
Finally ssh into your container to keep the service and container alive
subprocess.check_call(['powershell.exe', 'docker exec -ti app /bin/bash'])
Now install the service using python service.py install
Now you need to create a service account on the VM that has local admin rights. Go to Services in windows, and find your service in the list of services. Right click -> properties -> Log On and enter the service account details under "This account". Finally, under general, select automatic(delayed) start and start the service.
Probably not the most 'by the book' method, but it worked for me.
what version of docker did you install exactly / in detail?
The procedure to get docker running on a server is very different than for desktops!
It's purely script based as described in detail in the MS virtualization docs
The executable name of the windows-server docker EE (enterprise) service is by the way indeed dockerd as in linux.
FYI - This all works when run on a Mac, but I am wanting to run on Windows.
I am running the following commands from IntelliJ terminal:
1 - docker login (logging in with my credentials and getting the success message)
2 - docker-compose up (to create and start the container)
However upon running the second command, I am greeted with:
Pulling marklogic (xxxxxxx:latest)...
ERROR: pull access denied for ..., repository does not exist or may require 'docker login'
I have searched the forums and found nothing to explain what is going wrong, other than my colleagues explanation that Windows is rubbish.
Any help would be appreciated.
Some extra info:
docker -v
Docker version 17.12.0-ce, build c97c6d6
docker-compose -v
docker-compose version 1.18.0, build 8dd22a96
Well pressassociation/faux-uds-marklogic isn't in DockerHub, so I guess you have to build that first yourself, or make sure your are pointing at an internal company repository that someone else has pushed the image to.
Perhaps it works on the Mac because a docker login has been made to an internal registry before running the docker-compose up ?
Do you use your own registry (docker-registry.xxx) in your project?
I'm trying to test out docker containers running with a domain credential and I'm following these instructions from Microsoft Docs. I have created the Group MSA, which I'm pretty sure I've done correctly as I can run other services on my local computer using it.
I'm testing on a Windows 10 PC, running hyper-v docker containers.
I have built an image called sqltest. When I run the following, the container does evey as expected:
docker run -it sqltest
I tried creating active directory credentials using this command:
New-CredentialSpec -Name developerpcsql -AccountName developerpcsql
Calling Get-CredentialSpec confirms that the json file is created as expected, and it looks right when I open the file.
To run the container, I'm using:
docker run -it --security-opt "credentialspec=file://developerpcsql.json" sqltest
When I do that, it takes about 30 seconds and then I get the following error:
Error response from daemon: container d97082fab98c0205c0072b0a8b79fb7835c8e90828498428b976e378762cc412 encountered an error during Start: failure in a Windows system call: The operation timed out because a response was not received from the Virtual Machine hosting the Container. (0xc0370109).
To confirm it's not my container I've also tried using the standard microsoft/servercore container and get the same error.
Any ideas on what I'm missing?
It looks like it does not work for Windows 10.
Here you can find discussion on the topic
Virtualization-Documentation git repo
It does work as expected for Windows Server 2016 Hosted container.