This repository was archived by the owner on Oct 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 270
This repository was archived by the owner on Oct 26, 2019. It is now read-only.
json: cannot unmarshal object into Go value of type []string #122
Copy link
Copy link
Closed
Description
Hi,
I’ve got a json: cannot unmarshal object into Go value of type []string error only when I’m trying to run a new container with Docker-PHP.
Here is my Docker version:
Docker version 1.7.1, build 786b29d
I’m running my application in a Docker container which use the docker socket as volume.
"Volumes": {
"/data": "/var/www/littleship",
"/var/run/docker.sock": "/run/docker.sock"
},
"VolumesRW": {
"/data": true,
"/var/run/docker.sock": true
},
And here is my Symfony action to create a container (https://github.com/ambroisemaupate/littleship/blob/master/src/AM/Bundle/DockerBundle/Controller/ContainerController.php#L144):
public function addAction(Request $request)
{
if (!$this->isGranted('ROLE_SUPER_ADMIN')) {
throw $this->createAccessDeniedException();
}
try {
$docker = $this->get('docker');
$cManager = $docker->getContainerManager();
$iManager = $docker->getImageManager();
$form = $this->createForm(new ContainerType($iManager, $cManager));
$form->handleRequest($request);
if ($form->isValid()) {
$data = $form->getData();
$newCont = new Container([
'HostConfig' => [
'Links' => $data['links'],
'VolumesFrom' => $data['volumes_from'],
'PublishAllPorts' => (boolean) $data['publish_ports'],
'RestartPolicy' => [
'Name' => $data['restart_policy'],
'MaximumRetryCount' => 0
]
]
]);
$newCont->setImage($data['image']);
$newCont->setExposedPorts($this->getExposedPorts($data['ports']));
$newCont->setName($data['name']);
$newCont->setEnv($data['env']);
$cManager->run($newCont, null, [], true);
return $this->redirect($this->generateUrl('am_docker_container_list'));
}
$assignation['form'] = $form->createView();
} catch (RequestException $e) {
$assignation['error'] = $e->getMessage();
}
return $this->render('AMDockerBundle:Container:add.html.twig', $assignation);
}
This action perfectly worked before Docker 1.7.1 upgrade, and other actions still work (stop, restart and remove containers). Do you have any idea ? Do you need more informations ?
Thanks!
Sincerely,
Ambroise