Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
2f5f6c15
Commit
2f5f6c15
authored
Jul 16, 2015
by
Chris Bednarski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2462 from georgevicbell/master
Add PTY to Docker exec
parents
39a8ba13
bf0c326c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
3 deletions
+9
-3
builder/docker/communicator.go
builder/docker/communicator.go
+6
-2
builder/docker/config.go
builder/docker/config.go
+1
-1
builder/docker/step_connect_docker.go
builder/docker/step_connect_docker.go
+2
-0
No files found.
builder/docker/communicator.go
View file @
2f5f6c15
...
...
@@ -24,7 +24,7 @@ type Communicator struct {
HostDir
string
ContainerDir
string
Version
*
version
.
Version
Config
*
Config
lock
sync
.
Mutex
}
...
...
@@ -45,7 +45,11 @@ func (c *Communicator) Start(remote *packer.RemoteCmd) error {
var
cmd
*
exec
.
Cmd
if
c
.
canExec
()
{
cmd
=
exec
.
Command
(
"docker"
,
"exec"
,
"-i"
,
c
.
ContainerId
,
"/bin/sh"
)
if
c
.
Config
.
Pty
{
cmd
=
exec
.
Command
(
"docker"
,
"exec"
,
"-i"
,
"-t"
,
c
.
ContainerId
,
"/bin/sh"
)
}
else
{
cmd
=
exec
.
Command
(
"docker"
,
"exec"
,
"-i"
,
c
.
ContainerId
,
"/bin/sh"
)
}
}
else
{
cmd
=
exec
.
Command
(
"docker"
,
"attach"
,
c
.
ContainerId
)
}
...
...
builder/docker/config.go
View file @
2f5f6c15
...
...
@@ -28,7 +28,7 @@ type Config struct {
LoginUsername
string
`mapstructure:"login_username"`
LoginPassword
string
`mapstructure:"login_password"`
LoginServer
string
`mapstructure:"login_server"`
Pty
bool
ctx
interpolate
.
Context
}
...
...
builder/docker/step_connect_docker.go
View file @
2f5f6c15
...
...
@@ -7,6 +7,7 @@ import (
type
StepConnectDocker
struct
{}
func
(
s
*
StepConnectDocker
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
config
:=
state
.
Get
(
"config"
)
.
(
*
Config
)
containerId
:=
state
.
Get
(
"container_id"
)
.
(
string
)
driver
:=
state
.
Get
(
"driver"
)
.
(
Driver
)
tempDir
:=
state
.
Get
(
"temp_dir"
)
.
(
string
)
...
...
@@ -25,6 +26,7 @@ func (s *StepConnectDocker) Run(state multistep.StateBag) multistep.StepAction {
HostDir
:
tempDir
,
ContainerDir
:
"/packer-files"
,
Version
:
version
,
Config
:
config
,
}
state
.
Put
(
"communicator"
,
comm
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment